Aan de slagGa gratis aan de slag

Importing a CSV file

In this exercise, you will import the file sample.csv using both read.csv() and fread() to compare these functions. Here are the contents of this file:

id,"name",val
29192,"Robert Whitaker", 200
49301 ,"Elisa Waters,190  

The values in the file are separated by a comma. Note the unwanted spaces between entries, and the imbalanced quote in the second row.

Deze oefening maakt deel uit van de cursus

Data Manipulation with data.table in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import using read.csv()
csv_file <- ___(___, fill = NA, quote = "", 
                     strip.white = TRUE, 
                     header = TRUE)
csv_file
Code bewerken en uitvoeren