read.isi {Read.isi} | R Documentation |
Reads ISI-formatted code-books and uses this to read fixed-width formatted data-files into R-Project.
read.isi(input.file, dat.file, add.missings = TRUE, add.value.labels = TRUE, ...)
input.file |
Location of the ISI-formatted .dct code-book file. |
dat.file |
Location of the fixed-width data-file to load. |
add.missings |
Should value labels indicating missing values be transformed to NA? Defaults to TRUE. |
add.value.labels |
Should value labels be appended to the variables? Defaults to TRUE. |
... |
Further arguments transferred to read.fwf and read.table, such as 'n' and 'skip' (see below). |
Returns a data.frame containing the data stored in 'dat.file'. Variables are either numeric vectors or factors.
Using read.isi is computationally demanding; older systems with low levels of available RAM are easily brought to a halt. Instead use convert.isi to convert code-book to SPSS-interpretable syntax, or use 'n' and 'skip' sub-commands to subsequently read parts of the data-file (i.e. 1000 records at a time)
Rense Nieuwenhuis (contact@rensenieuwenhuis.nl)
More information on usage and background of the development can be found on www.rensenieuwenhuis.nl/r-project/my-functions/read-isi/
## Examples can only be run using external code-book and data-files ## Basic reading of data based on code-book: # read.isi("filename-codebook.dct", "filename-data.dat") ## Value labels and missing values, as indicated in the code-book, are not assigned: # read.isi("filename-codebook.dct", "filename-data.dat", value.labels=FALSE, missings=FALSE) ## Only records 501 thru 1500 are read, if available # read.isi("filename-codebook.dct", "filename-data.dat", skip=500, n=1000)