ez.reads | R Documentation |
ez.reads: haven (label,labels), usrna always to NA, col width >255 characters OK, Date, Time -> Date, hms/difftime
ez.reads2: foreign (variable.labels, value.labels), perserve initial usrna if necessary, col width >255 characters Bad, Date, Time -> numeric.
I hacked to trim (leading and trailing) string spaces (The leading spaces could be previously added by user, the trailing could come from SPSS padding to Width). Also, I hacked to auto replace col names (eg, @->.), see param makenames if one wants keep variable names as is.
ez.reads(
path,
atm2fac = 2,
usrna = TRUE,
tolower = FALSE,
stringsAsFactors = FALSE,
blanksAsNA = TRUE,
na.strings = c("", "."),
makenames = TRUE,
...
)
path |
File path to the data file |
atm2fac |
c(1,2,3). atomic means logic,numeric/double,integer,character/string etc. Char to factor controlled separately by stringsAsFactors.
|
usrna |
(unfortunately, no effect as of the underlying HAVEN v0.2.1/v1.1.0) if TRUE, honor/convert user-defined missing values in SPSS to NA after reading into R; if FALSE, keep user-defined missing values in SPSS as their original codes after reading into R. |
tolower |
whether to convert all column names to lower case |
stringsAsFactors |
T/F |
blanksAsNA |
T/F, converts factor or character vector elements to NA if matching na.strings |
na.strings |
only applicable if blanksAsNA=T. e.g., c(”,'.','NA','na','N/A','n/a','NaN','nan') |
makenames |
if F, keep as is. if T, call make.names(unique=TRUE,allow_=TRUE) _ kept, The character "X" is prepended if necessary. All invalid characters are translated to "." .1 .2 etc appended for uniqueness |
wrapper of sjmisc_read_spss
, uderlying of which it uses HAVEN v0.2.1/v1.1.0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.