import_ascii | R Documentation |
import_ascii
imports ASCII data files using their associated SPSS setup files.
import_ascii(data_file, setup_file, card_pattern, respondent_pattern)
data_file |
A path to an ASCII data file. |
setup_file |
A path to the corresponding SPSS setup file. |
card_pattern |
For use when the file does not contain a line for every card for every respondent (or contains extra lines that correspond to no respondent), a regular expression that matches the file's card identifier; e.g., if the card number is stored in the last digit of each line, "\d$". |
respondent_pattern |
For use when the file does not contain a line for every card for every respondent (or contains extra lines that correspond to no respondent), a regular expression that matches the file's respondent identifier; e.g., if the respondent number is stored in the first four digits of each line, preceded by a space, "(?<=^\s)\d4". |
total_cards |
For multicard files, the number of cards in the file. |
var_names |
A string vector of variable names. |
var_cards |
For multicard files, a numeric vector of the cards on which |
var_positions |
A numeric vector of the column positions in which |
var_widths |
A numeric vector of the widths used to record |
Many older survey datasets are available only in ASCII format, which is notoriously difficult to work with. The 'import_ascii' function imports uses the SPSS setup file to import data stored in this archaic format.
See read_rpr
and read_roper
for implementations that read single, specified variables.
A data frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.