read_file | R Documentation |
Read raw data either using FILID
value or a complete file path.
It uses the find_data()
generic method. For a .csv
file,
data.table::fread()
is used and all other arguments for fread
function can be used. For a .xlsx
or .xls
file
readxl::read_excel()
function and all of its arguments. For a .dta
file, haven::read_dta()
is used and all other arguments for
read_dta
function can be used.
Nevertheless, some most used arguments are standardized for
read_file()
and they are:
nrows
to display maksimum
numbers of rows to read
header
FALSE to give default columnames as V1
,
V2
etc
skip
a specific number of rows before reading the data
trimws
to trim leading and trailing whitespace
na
for character value to be interpreted as NA
read_file(file = NULL, ...)
les_fil(file = NULL, ...)
rdf(file = NULL, ...)
file |
Use FILID, FILEGROUP or a complete path of a filename. Data set
with |
... |
All other arguments to be passed related to the file format |
## Not run:
# With FILID
DT <- read_file(file = 5)
DT <- read_file(file = 5, fill = TRUE, nrows = 10)
# With FILEGROUP
dt <- read_file(file = "UTFORE")
# With filepath
rdata <- read_file(file = "/file/path/mydata.xlsx", sheet = "S3", range = cell_rows(1:4))
rdata <- read_file(file = "/file/path/mydata.csv", sep = ",", header = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.