read.file(file, header = T, na.strings = "NA", comment.char = NULL,
filetype = c("default", "csv", "txt", "tsv", "fw", "rdata"),
stringsAsFactors = FALSE, readr = FALSE, package = NULL, ...)
getwd()
.txt
and .csv
files, this indicates whether the first line of the file includes variables names."default"
, "csv"
, "txt"
, or "rdata"
indicating the type of file being loaded. The default is to use the filename
to guess the type of file.readr
.readr
package should be
used, if available.read.table
, or load
or one of the functions
in the readr
package. Note that a message will indicate which
ufile
unless filetype
is "rdata"
,
in which case arbitrary objects may be loaded and a character vector
holding the names of the loaded objects is returned invisibly.filetype
is specified,
read.file
uses the (case insensitive) file extension to determine how to read
data from the file. If file
ends in .rda
or .rdata
, then
load
is used to load the file. If file
ends in .csv
, then read_csv
or read.csv
is used.
Otherwise, read.table
is used.read.csv
, read.table
,
read_table
, read_csv
,
load
.Dome <- read.file("http://www.mosaic-web.org/go/datasets/Dome.csv")
Mustangs <- read.file("MustangPrice.csv", package="mosaic")
Run the code above in your browser using DataLab