fImport
fImport.RdGeneral File Import Using rio
Usage
fImport(
file,
format,
lowernames = c("not mixed", "no", "yes"),
und. = FALSE,
...
)Arguments
- file
name of file to import, or full URL.
riodetermines the file type from the file suffix unless you override this withformat- format
format of file to import, usually not needed. See
rio::import()for details- lowernames
defaults to changing variable names to all lower case unless the name as mixed upper and lower case, which results in keeping the original characters in the name. Set
lowernames='no'to leave variable names as they were created in the original file export, or setlowernames='yes'to set all names to lower case whether they have mixed case or not. For all options, a check is made to see if the name conversions would result in any duplicate names. If so, the original names are retained and a warning message issued.- und.
set to
TRUEto change all underscores in names to periods- ...
more arguments to pass to
rio::import()
Details
This is a front-end for the rio package's import function. fImport includes options for setting variable names to lower case and to change underscores in names to periods. Variables on the imported data frame that have labels are converted to Hmisc package labelled class so that subsetting the data frame will preserve the labels.
Examples
if (FALSE) { # \dontrun{
# Get a Stata dataset
d <- fImport('http://www.principlesofeconometrics.com/stata/alcohol.dta')
contents(d)
} # }