Open files

R basics
Input files
Author

Karen C. Goncalves dos Santos

Published

November 3, 2023

Basic read.XXXX and tidyverse read_XXXX

read.XXX

These functions are available without loading any package

Function Column separation Decimal separation
read.csv sep = "," dec = "."
read.csv2 sep = ";" dec = ","
read.delim sep = "\t" (tab) dec = "."
read.delim2 sep = "\t" (tab) dec = ","

read_XXX

These functions are available after loading tidyverse. They are the equivalent of the read.XXXX, but are faster and so better for big datasets.

Note that they produce tibbles, not data.frames. Though similar, tibbles do not have row names. If your first column has no name because it contains row names, R will replace the empty cell with ...1.

You use col_names to indicate if there are column names or to give a vector with the column names.

Function Column separation Decimal separation
read_csv sep = "," dec = "."
read_csv2 sep = ";" dec = ","
read_delim sep = "\t" (tab) dec = "."
read_delim2 sep = "\t" (tab) dec = ","
Back to top