Function to read a SPSS por file into a data.frame().

read.por(
  file,
  convert.factors = TRUE,
  generate.factors = TRUE,
  encoding = TRUE,
  fromEncoding = NULL,
  use.missings = TRUE,
  debug = FALSE,
  override = FALSE,
  convert.dates = TRUE,
  add.rownames = FALSE
)

Arguments

file

string a por-file to import. can be a file on a computer or an url. in this case the file will be downloaded and read before it is used.

convert.factors

logical if true numeric or character variables will be converted into a factor in R.

generate.factors

logical function to convert variables with partial labels into factors. e.g. 1 - low and 5 - high are provided, labels 2, 3 and 4 will be created. especially useful in combination with use.missings=TRUE.

encoding

logical shall values be converted? If true, read.por() will try the charcode stored inside the por-file. If this value is 2 or not available, fromEncoding can be used to change encoding.

fromEncoding

character encoding of the imported file. This information is stored inside the por-file, but is currently unused. Still this option can be used to define the initial encoding by hand.

use.missings

logical should missing values be converted. Defaults to TRUE.

debug

logical provides additional debug information. Most likely not useful to any user.

override

logical The filename provided in file is checked for the ending por. If the file ending is different, nothing is read. This option can be used to override this behavior.

convert.dates

logical Should dates be converted on the fly?

add.rownames

logical If TRUE, the first column will be used as rownames. Variable will be dropped afterwards.

Details

SPSS files are widely available, though for R long time only foreign and memisc provided functions to import por-files. Lately haven joined. This package is an approach to offer another alternative, to document the por-format and provide additional options to import the data.

Note

Information to decrypt the por-format was provided by tda www.stat.rub.de/tda.html and pspp www.gnu.org/software/pspp/

See also

read.spss, memisc.