Function to write an SPSS por file. Returns an por file that read.por can read as well as SPSS can. Other packages as foreign, memisc and haven might fail (fail reading or return wrong values).
write.por(
dat,
filepath,
label,
add.rownames = FALSE,
convert.factors = TRUE,
toEncoding = "CP1252",
convert.dates = TRUE,
tz = "GMT"
)
data.frame a data.frame to export as por-file.
string full path where and how this file should be stored
character vector of labels. must be of size ncol(dat)
logical If TRUE
, a new variable rownames
will be added to the por-file.
logical If TRUE
, factors will be converted to
SPSS variables with labels.
SPSS expects strings to be encoded as Windows-1252, so all levels will be
recoded. Character which can not be mapped in Windows-1252 will be saved as
hexcode.
character encoding used for the por file. SPSS itself claims to have problems with unicode and por files, so "CP1252" is the default.
logical should dates be converted to SPSS format
character The name of the timezone convert.dates will use.
write.por
returns nothing
Strings longer than 255 chars are not provided. File will be stored using "CP1252" encoding.