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 readheader
FALSE to give default columnames asV1
,V2
etcskip
a specific number of rows before reading the datatrimws
to trim leading and trailing whitespacena
for character value to be interpreted asNA
Examples
if (FALSE) { # \dontrun{
# 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)
} # }