Skip to contents

This function reads an `.asc`` data file.

Usage

readSSSdata(x, ascFilename)

Arguments

x

Name of .asc file containing the survey metadata

ascFilename

No longer used. Use x instead.

See also

Examples

sampleRoot <- system.file("sampledata", package = "sss")
filenameSSS <- file.path(sampleRoot, "sample-1.sss")
filenameASC <- file.path(sampleRoot, "sample-1.asc")

readSSSdata(filenameSSS)
#>  [1] "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"                            
#>  [2] "<!DOCTYPE sss PUBLIC \"-//Triple-S//DTD Survey Interchange v1.2//EN\""      
#>  [3] "                     \"http://triple-s.org/dtd/sss_v12.dtd\">"              
#>  [4] "<sss version=\"1.2\" options=\"standardnames\">"                            
#>  [5] "<date>21 September 2001</date>"                                             
#>  [6] "<time>18:32</time>"                                                         
#>  [7] "<origin>Export 1.42</origin>"                                               
#>  [8] "<survey>"                                                                   
#>  [9] "    <name>SP5201-1</name>"                                                  
#> [10] "    <title>Historic House Exit Survey<br/>First Wave</title>"               
#> [11] "    <record ident=\"V\">"                                                   
#> [12] "        <variable ident=\"1\" type=\"single\">"                             
#> [13] "            <name>Q1</name>"                                                
#> [14] "            <label>Number of visits</label>"                                
#> [15] "            <position start=\"1\" />"                                       
#> [16] "            <values>"                                                       
#> [17] "                <value code=\"1\">First visit</value>"                      
#> [18] "                <value code=\"2\">Visited before within the year</value>"   
#> [19] "                <value code=\"3\">Visited before that</value>"              
#> [20] "            </values>"                                                      
#> [21] "        </variable>"                                                        
#> [22] "        <variable ident=\"2\" type=\"multiple\">"                           
#> [23] "            <name>Q2</name>"                                                
#> [24] "            <label>Attractions visited</label>"                             
#> [25] "            <position start=\"2\" finish=\"10\" />"                         
#> [26] "            <values>"                                                       
#> [27] "                <value code=\"1\">Sherwood Forest</value>"                  
#> [28] "                <value code=\"2\">Nottingham Castle</value>"                
#> [29] "                <value code=\"3\">&quot;Friar Tuck&quot; Restaurant</value>"
#> [30] "                <value code=\"4\">&quot;Maid Marion&quot; Cafe</value>"     
#> [31] "                <value code=\"5\">Mining museum</value>"                    
#> [32] "                <value code=\"9\">Other</value>"                            
#> [33] "            </values>"                                                      
#> [34] "        </variable>"                                                        
#> [35] "        <variable ident=\"3\" type=\"character\">"                          
#> [36] "            <name>Q3</name>"                                                
#> [37] "            <label>Other attractions visited</label>"                       
#> [38] "            <position start=\"11\" finish=\"40\" />"                        
#> [39] "            <size>30</size>"                                                
#> [40] "        </variable>"                                                        
#> [41] "        <variable ident=\"4\" type=\"multiple\">"                           
#> [42] "            <name>Q4</name>"                                                
#> [43] "            <label>Two favourite attractions visited</label>"               
#> [44] "            <position start=\"41\" finish=\"42\" />"                        
#> [45] "            <spread subfields=\"2\" />"                                     
#> [46] "            <!--same answer list as Q2-->"                                  
#> [47] "            <values>"                                                       
#> [48] "                <value code=\"1\">Sherwood Forest</value>"                  
#> [49] "                <value code=\"2\">Nottingham Castle</value>"                
#> [50] "                <value code=\"3\">&quot;Friar Tuck&quot; Restaurant</value>"
#> [51] "                <value code=\"4\">&quot;Maid Marion&quot; Cafe</value>"     
#> [52] "                <value code=\"5\">Mining museum</value>"                    
#> [53] "                <value code=\"9\">Other</value>"                            
#> [54] "            </values>"                                                      
#> [55] "        </variable>"                                                        
#> [56] "        <variable ident=\"5\" type=\"quantity\">"                           
#> [57] "            <name>Q5</name>"                                                
#> [58] "            <label>Miles travelled</label>"                                 
#> [59] "            <position start=\"43\" finish=\"45\" />"                        
#> [60] "            <values>"                                                       
#> [61] "                <range from=\"1\" to=\"499\" />"                            
#> [62] "                <value code=\"500\">500 or more</value>"                    
#> [63] "                <value code=\"999\">Not stated</value>"                     
#> [64] "            </values>"                                                      
#> [65] "        </variable>"                                                        
#> [66] "        <variable ident=\"6\" type=\"logical\">"                            
#> [67] "            <name>Q6</name>"                                                
#> [68] "            <label>Would come again</label>"                                
#> [69] "            <position start=\"46\" />"                                      
#> [70] "        </variable>"                                                        
#> [71] "        <variable ident=\"7\" type=\"single\">"                             
#> [72] "            <name>Q7</name>"                                                
#> [73] "            <label>When is that most likely to be</label>"                  
#> [74] "            <position start=\"47\" />"                                      
#> [75] "            <filter>Q6</filter>"                                            
#> [76] "            <values>"                                                       
#> [77] "                <value code=\"1\">Within 3 months</value>"                  
#> [78] "                <value code=\"2\">Between 3 months and 1 year</value>"      
#> [79] "                <value code=\"3\">More than 1 years time</value>"           
#> [80] "            </values>"                                                      
#> [81] "        </variable>"                                                        
#> [82] "        <variable ident=\"99\" type=\"quantity\">"                          
#> [83] "            <name>Q99</name>"                                               
#> [84] "            <label>Case weight</label>"                                     
#> [85] "            <position start=\"48\" finish=\"54\"/>"                         
#> [86] "            <range from=\"0.0000\" to=\"99.9999\"/>"                        
#> [87] "        </variable>"                                                        
#> [88] "    </record>"                                                              
#> [89] "</survey>"                                                                  
#> [90] "</sss>"                                                                     
readSSSmetadata(filenameSSS)
#> {xml_document}
#> <sss version="1.2" options="standardnames">
#> [1] <date>21 September 2001</date>
#> [2] <time>18:32</time>
#> [3] <origin>Export 1.42</origin>
#> [4] <survey>\n  <name>SP5201-1</name>\n  <title>Historic House Exit Survey<br ...