Read SPSS Data Files and Truncate Space in String Variables and Change Column Width
readSpss.Rd
This function reads SPSS data files using the function read.spss
from the foreign
package and converts all variables to class character
. Additionally, leading and trailing white spaces can be removed from character variables, numeric values can be padded with leading zeros for uniform width of all entries in a column.
Details
If addLeadingZeros=TRUE
, the values in each column are transformed to have uniform width by adding leading zeros. The width of a column is determined by the longest value in this column, e.g., if a column contains the values 1, 10, 100
the transformed column will be 001, 010, 100
. This can be useful if the values had leading zeros which were removed by reading in the SPSS file.