- file
File name (with extension).
If unspecified, then data will be imported from clipboard.
- encoding
File encoding. Defaults to NULL
.
Options: "UTF-8"
, "GBK"
, "CP936"
, etc.
If you find messy code for Chinese text in the imported data,
it is usually effective to set encoding="UTF-8"
.
- header
Does the first row contain column names (TRUE
or FALSE
)?
Defaults to "auto"
.
- sheet
[Only for Excel] Excel sheet name (or sheet number).
Defaults to the first sheet.
Ignored if the sheet is specified via range
.
- range
[Only for Excel] Excel cell range.
Defaults to all cells in a sheet.
You may specify it as range="A1:E100"
or range="Sheet1!A1:E100"
.
- pkg
[Only for SPSS & Stata] Use which R package to read
SPSS (.sav) or Stata (.dta) data file?
Defaults to "haven"
. You may also use "foreign"
.
Notably, "haven"
may be preferred because it is more robust to
non-English characters and can also keep variable labels (descriptions)
from SPSS.
- value.labels
[Only for SPSS & Stata] Convert variables with value labels
into R factors with those levels? Defaults to FALSE
.
- as
Class of the imported data.
Defaults to "data.frame"
.
Ignored if the file is an R data object (.rds, .rda, .rdata, .RData).
Options:
data.frame: "data.frame"
, "df"
, "DF"
data.table: "data.table"
, "dt"
, "DT"
tbl_df: "tibble"
, "tbl_df"
, "tbl"
- verbose
Print data information? Defaults to FALSE
.