read.formscanner: Import Data From FormScanner

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function imports data from the FormScanner software.

Usage

1
read.formscanner(file, col.names, conc = NULL, id = NULL, dummy = NULL)

Arguments

file

the name of the csv file to be imported.

col.names

the names of the columns. If NULL the names of the columns are those given in the csv file.

conc

a vector containing which columns to concatenate. Columns can be specified by name or number.

id

name of the column that uniquely identifies the row.

dummy

a vector containing the columns to convert to dummy variables. Columns can be specified by name or number.

Details

If some columns are concatenated using argument conc, the name of the newly created variable is the name of the first column.

test and questionnaire are instances of the output of function read.formscanner.

When id is obtained as the concatenation of different columns using argument conc, id should be set equal to the first column concatenated.

Value

A data frame.

Author(s)

Michela Battauz

References

Borsetta, A. (2016). FormScanner, [Computer Software], URL http://sourceforge.net/projects/formscanner/.

See Also

addkey, addweights

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# find the directory with package fsia
dir_pkg <- find.package("fsia")
# the example files are in the directory examples
# create the path
questionnaire_path <- file.path(dir_pkg, "examples", "scan_results_questionnaire.csv")
test_path <- file.path(dir_pkg, "examples", "scan_results_test.csv")
# import file "scan_results_questionnaire.csv"
questionnaire_imp<-read.formscanner(questionnaire_path, dummy = "Q5.sources")
questionnaire_imp
# questionnaire_imp is equal to the data questionnaire
# import file "scan_results_test.csv"
test_imp <- read.formscanner(test_path, conc = paste("id", 1:6, sep = ""), id = "id1")
test_imp
# test_imp is equal to the data test

Example output

  File.name Q1.gender Q2.age Q3.restaurants      Q4.movies       Q4.music
1    Q00004         F    <25            1-2 strongly agree strongly agree
2    Q00003         F  30-39            5-6          agree          agree
3    Q00002         M  40-49             <1          agree       disagree
4    Q00001         M  25-29            3-4 strongly agree          agree
5    Q00005         F   >=60           <NA>          agree       disagree
      Q4.reading             Q5.sources
1 strongly agree            TV|internet
2 strongly agree TV|internet|newspapers
3       disagree    TV|newspapers|radio
4       disagree  TV|internet|magazines
5       disagree               TV|radio
                                    Q6.interviewer Q5.sources.TV
1 Interviewer: Mario Rossi\nInverviewer ID: 458788             1
2 Interviewer: Mario Rossi\nInverviewer ID: 458788             1
3 Interviewer: Mario Rossi\nInverviewer ID: 458788             1
4 Interviewer: Mario Rossi\nInverviewer ID: 458788             1
5 Interviewer: Mario Rossi\nInverviewer ID: 458788             1
  Q5.sources.internet Q5.sources.magazines Q5.sources.newspapers
1                   1                    0                     0
2                   1                    0                     1
3                   0                    0                     1
4                   1                    1                     0
5                   0                    0                     0
  Q5.sources.radio
1                0
2                0
3                1
4                0
5                1
  File.name Question01 Question02 Question03 Question04 Question05 Question06
1    T00001        A|B        A|C          B          C          C          D
2    T00002        C|D        B|C          B          B          A          D
3    T00003        B|C        A|C          B          D          B          B
4    T00004          C        A|B          D          D          C          A
5    T00005        A|C          D          B          D          B          A
  Question07 Question08 Question09 Question10 Question11 Question12 Question13
1          A          D          C          B          C          A          A
2          B          B          A          D          C          B          C
3          C          B          C          B          A          D          B
4          D          B          D        A|D          B          D          C
5          D          C          A          B          C          B          C
  Question14 Question15 Question16 Question17 Question18 Question19 Question20
1          B          D          C          B          A          B          D
2          A          A          B          D          C          A          B
3          C          A          C          D          B          C          A
4          A          D       <NA>          B          C          A          C
5          B          D          A          B          B          D          D
  Question21 Question22 Question23 Question24 Question25 Question26 Question27
1          B          C          A          D          C          D          B
2          C          B          D          A          B          C          C
3          B          D          A          B          C          B          D
4          B          D          A          D          C          B       <NA>
5          B          C          B          C          D          A          A
  Question28 Question29 Question30 Question31 Question32 Question33 Question34
1          A          A          B          C          C          D          A
2          B          A          C          B          D          D          A
3          D          A          B          B          C          C          A
4          C          B          A          D          B          A          C
5          B          C          B          D          C          A          C
  Question35 Question36 Question37 Question38 Question39 Question40   i.course
1          C          A          C          B          C          A Statistics
2          B          C          C          A          B          D Statistics
3          B          D          C          D          A          B Statistics
4          D          B          C          A          C          D Statistics
5          B          C          A          C          B          B Statistics
         i.university     id
1 University of Udine 104556
2 University of Udine 245784
3 University of Udine 102344
4 University of Udine 205790
5 University of Udine 199733

fsia documentation built on May 2, 2019, 5:42 a.m.