R Studio and data import

In R, data importing can be done in several ways, including using the ‘readr’ function.

R Studio provides an interface for these common functions.   You can import as text (readr).

R Studio will then allow you to preview the data, and to skip rows that are unnecessary, in order to ensure that the data appears in rows and columns.  You can specify whether or not the data has a row header or not.

This will generate the equivalent R code for you, so that it is visible:

foo <- read_csv("~/Documents/code/fooname.csv", 
col_names = FALSE, skip = 2)

Leave a comment

Your email address will not be published. Required fields are marked *