read.csv(file, header = TRUE, sep = ",", quote = """, dec = ".", fill = TRUE, comment.char = "", ...)
read.csv2(file, header = TRUE, sep = ";", quote = """, dec = ",", fill = TRUE, comment.char = "", ...)
readr::read_csv(file, col_names = TRUE, col_types = NULL, locale = default_locale(), na = c("", "NA"), comment = "", trim_ws = TRUE, skip = 0, n_max = -1, progress = interactive())
data.table::fread(input, sep="auto", sep2="auto", nrows=-1L, header="auto", na.strings="NA", stringsAsFactors=FALSE, verbose=getOption("datatable.verbose"), autostart=1L, skip=0L, select=NULL, drop=NULL, colClasses=NULL, integer64=getOption("datatable.integer64"), # default: "integer64" dec=if (sep!=".") "." else ",", col.names, check.names=FALSE, encoding="unknown", strip.white=TRUE, showProgress=getOption("datatable.showProgress"), # default: TRUE data.table=getOption("datatable.fread.datatable") # default: TRUE )
Parameter | Details |
---|---|
file | name of the CSV file to read |
header | logical: does the .csv file contain a header row with column names? |
sep | character: symbol that separates the cells on each row |
quote | character: symbol used to quote character strings |
dec | character: symbol used as decimal separator |
fill | logical: when TRUE, rows with unequal length are filled with blank fields. |
comment.char | character: character used as comment in the csv file. Lines preceded by this character are ignored. |
... | extra arguments to be passed to read.table |
Note that exporting to a plain text format sacrifices much of the information encoded in the data like variable classes for the sake of wide portability. For cases that do not require such portability, a format like .RData or Feather may be more useful.
Input/output for other types of files is covered in several other topics, all linked from Input and output.