use_incadata.Rd
Read in a file (locally) or use global object named df
(on INCA)
and coerce to incadata
-object.
use_incadata(file, cache = TRUE, sep = ";", dec = ",", ...)
file | file name as character (ignored if called from INCA) |
---|---|
cache | use cache to speed up the loading (see section: "Cache" below) |
sep, dec | arguments passed to |
... | arguments passed to |
object returned by as.incadata
To process all data through as.incadata
can be
time consuming for large data sets. It is therefore advised to use caching
(argument cache = TRUE
) to avoid unnecessary processing of already
formatted data. If cache = TRUE
, the function will read and process
the data only the first time (or if the original data is later changed). A
processed and cached version of the data is saved with suffix ".rds". The
cached version is always compared to the original file by its MD5 sum and
is always updated if needed.
if (FALSE) { # Create a csv file with example data in a temporary directory fl <- tempfile("ex_data", fileext = ".csv2") write.csv2(incadata::ex_data, fl) # First time the file is read from csv2 use_incadata(fl) dir(tempdir) # a cache file is saved along the original csv2-file use_incadata(fl) # Next time file loaded from cache }