Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Read and View | Data Manipulation and Cleaning
Data Analysis with R

bookRead and View

Before you can analyze data, you need to bring it into your R environment. In most real-world scenarios, data is stored in external files or databases. The first step in any data analysis workflow is importing that data so you can begin exploring and working with it.

Common data sources

Real-world data often comes from a variety of sources, such as:

  • CSV (comma-separated values) files;
  • Excel spreadsheets;
  • Plain text (TXT) files;
  • Databases (e.g., SQL, SQLite, PostgreSQL);
  • Web APIs or other online sources.

R provides a range of functions and packages to help read data from each of these sources easily.

Reading a CSV file

CSV is one of the most commonly used formats for storing tabular data. To import a CSV file into R, we typically use a function that reads the file and stores it in a data frame - a structure that organizes data in rows and columns.

df <- read_csv("car_details.csv")

Viewing your data

Once the data is loaded, it's helpful to take a quick look at it. One simple way to do this in RStudio is with the View() function:

View(df)
question mark

Which function reads CSV files in tidyverse?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 3

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

How do I import data from other file types like Excel or TXT in R?

Can you explain more about the tidyverse package and its main functions?

What should I do if I get an error while trying to read a CSV file?

Awesome!

Completion rate improved to 4

bookRead and View

Swipe um das Menü anzuzeigen

Before you can analyze data, you need to bring it into your R environment. In most real-world scenarios, data is stored in external files or databases. The first step in any data analysis workflow is importing that data so you can begin exploring and working with it.

Common data sources

Real-world data often comes from a variety of sources, such as:

  • CSV (comma-separated values) files;
  • Excel spreadsheets;
  • Plain text (TXT) files;
  • Databases (e.g., SQL, SQLite, PostgreSQL);
  • Web APIs or other online sources.

R provides a range of functions and packages to help read data from each of these sources easily.

Reading a CSV file

CSV is one of the most commonly used formats for storing tabular data. To import a CSV file into R, we typically use a function that reads the file and stores it in a data frame - a structure that organizes data in rows and columns.

df <- read_csv("car_details.csv")

Viewing your data

Once the data is loaded, it's helpful to take a quick look at it. One simple way to do this in RStudio is with the View() function:

View(df)
question mark

Which function reads CSV files in tidyverse?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 3
some-alt