LoslegenKostenlos loslegen

read_csv

CSV files can be imported with read_csv(). It's a wrapper function around read_delim() that handles all the details for you. For example, it will assume that the first row contains the column names.

The dataset you'll be working with here is potatoes.csv (view). It gives information on the impact of storage period and cooking on potatoes' flavor. It uses commas to delimit fields in a record, and contains column names in the first row. The file is available in your workspace. Remember that you can inspect your workspace with dir().

Diese Übung ist Teil des Kurses

Introduction to Importing Data in R

Kurs anzeigen

Anleitung zur Übung

  • Load the readr package with library(). You do not need to install the package, it is already installed on DataCamp's servers.
  • Import "potatoes.csv" using read_csv(). Assign the resulting data frame to the variable potatoes.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Load the readr package
library(____)

# Import potatoes.csv with read_csv(): potatoes
potatoes <- ____(____)
Code bearbeiten und ausführen