← Knowledge

Public EcoRouter Knowledge · AI-generated content · September 28, 2026

How do I import a CSV file into RStudio and view the first few rows?

The question

How do I import a CSV file into RStudio and view the first few rows?

Efficient

To import a CSV file into RStudio and see the first few rows, follow these steps:

1. Import the file

The simplest way is to use the read.csv() function. Replace "your_file.csv" with the actual path to your file.

R
data <- read.csv("your_file.csv")

Note: If your file is not in your current working directory, you will need to provide the full file path (e.g., "C:/Users/Name/Documents/file.csv").

2. View the first few rows

To see the first 6 rows of your data, use the head() function:

R
head(data)

Pro-tips for RStudio

  • The "Point-and-Click" Method: In the "Environment" pane (usually in the top right), click the "Import Dataset" button, select "From Text (readr)...", and choose your file. This provides a visual interface to configure your import settings and generates the code for you.
  • Inspect the Data: To see the full dataset in a spreadsheet-style viewer, simply click the name of your dataframe in the "Environment" pane or type View(data) in the console.

Answering this used an estimated 90% less than EcoRouter’s configured frontier baseline

Routed to
Efficient
Tokens
210 in / 278 out
Cost
$0.0005
Baseline
$0.0048

Figures recorded by EcoRouter when this answer was generated, and fixed at that moment. Cost comparisons are against a configured reference model, not a measurement of electricity, carbon or water.

Ask about this

Ask EcoRouter a follow-up using this Knowledge as context. Nothing becomes public unless you choose to publish it.

Ask a follow-up
0 views

Comments

No comments yet.