read | R Documentation |
Read data and optionally clean column names, keep unique rows, and convert characters to factors
read(
filename,
datadir = NULL,
make.unique = TRUE,
character2factor = FALSE,
clean.colnames = TRUE,
delim.reader = c("data.table", "vroom", "duckdb", "arrow"),
xlsx.sheet = 1,
sep = NULL,
quote = "\"",
na.strings = c(""),
output = c("data.table", "default"),
attr = NULL,
value = NULL,
verbose = TRUE,
fread_verbose = FALSE,
timed = verbose,
...
)
filename |
Character: filename or full path if |
datadir |
Character: Optional path to directory where |
make.unique |
Logical: If TRUE, keep unique rows only |
character2factor |
Logical: If TRUE, convert character variables to factors |
clean.colnames |
Logical: If TRUE, clean columns names using clean_colnames |
delim.reader |
Character: package to use for reading delimited data |
xlsx.sheet |
Integer or character: Name or number of XLSX sheet to read |
sep |
Single character: field separator. If |
quote |
Single character: quote character |
na.strings |
Character vector: Strings to be interpreted as NA values.
For |
output |
Character: "default" or "data.table", If default, return the delim.reader's default data structure, otherwise convert to data.table |
attr |
Character: Attribute to set (Optional) |
value |
Character: Value to set (if |
verbose |
Logical: If TRUE, print messages to console |
fread_verbose |
Logical: Passed to |
timed |
Logical: If TRUE, time the process and print to console |
... |
Additional parameters to pass to |
read
is a convenience function to read:
Delimited files using data.table:fread()
, arrow:read_delim_arrow()
,
vroom::vroom()
, duckdb::duckdb_read_csv()
ARFF files using farff::readARFF()
Parquet files using arrow::read_parquet()
XLSX files using readxl::read_excel()
DTA files from Stata using haven::read_dta()
FASTA files using seqinr::read.fasta()
RDS files using readRDS()
E.D. Gennatas
## Not run:
datadir <- "~/icloud/Data"
dat <- read("iris.csv", datadir)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.