Erste SchritteKostenlos loslegen

read.csv

The utils package, which is automatically loaded in your R session on startup, can import CSV files with the read.csv() function.

In this exercise, you'll be working with swimming_pools.csv (view); it contains data on swimming pools in Brisbane, Australia. The file contains the column names in the first row. It uses a comma to separate values within rows.

Type dir() in the console to list the files in your working directory. You'll see that it contains swimming_pools.csv, so you can start straight away.

Diese Übung ist Teil des Kurses

Introduction to Importing Data in R

Kurs anzeigen

Anleitung zur Übung

  • Use read.csv() to import "swimming_pools.csv", which is located in the current directory, as a data frame with the name pools.
  • Print the structure of pools using str().

Interaktive Übung zum Anfassen

Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.

# Import swimming_pools.csv: pools
pools <- ___

# Print the structure of pools
___
Bearbeiten und Ausführen von Code