read_file | R Documentation |
Read a file that is either RDS, CSV, JSON, or YAML, with the method determined by the file extension.
read_file(file, ...)
file |
Character string of input file; must have file
extension |
... |
Passed to whatever function it calls |
For CSV files, we use qtl2::fread_csv()
,
which calls data.table::fread()
with a particular set
of options; note that columns are forced to be numeric in this
case.
For RDS files, we use base::readRDS()
. For JSON files,
we use base::readLines()
and
jsonlite::fromJSON()
. For YAML files, we use
yaml::yaml.load_file()
.
Could be most anything; whatever gets read in by the corresponding R function for the file type. See Details.
## Not run: w <- read_file("myfile.rds")
x <- read_file("myfile.csv")
y <- read_file("myfile.json")
z <- read_file("myfile.yaml")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.