9.4 Writing to Disk

As of the moment, you cannot write a valid SAS sas7bdat file from within R. However, you can write the file and read within R. The write_lsds function will allow you to write a dataset to the lsds folder and access said data with the normal wfudata function.

For example

## # A tibble: 3 x 2
##      ID Grade
##   <dbl> <chr>
## 1     1 A    
## 2     2 B    
## 3     3 C

I could then write this data to the lsds data store.

## Warning this function will only output a SAS dataset that can be read by R. The Rstudio team is working on resolving this issue.

The function will provide a warning message. However, when we list the data sets we can see that super_test exists. Please note that if you put any non-valid names, the program will automatically correct them.

##  [1] "_final2"                         "advisers"                       
##  [3] "continents"                      "continuous"                     
##  [5] "data_reduced_1"                  "db_student_features"            
##  [7] "db_student_results"              "deceased_at_wake"               
##  [9] "divisional_data"                 "divisional_data_final"          
## [11] "divisionals"                     "emails"                         
## [13] "enhanced_contact_1"              "enroll"                         
## [15] "fd_17_final"                     "fd_2017_final"                  
## [17] "final_retent"                    "final_retent_1st"               
## [19] "final_retent_1st_14"             "final_retent_1st_no14"          
## [21] "first_destination_final"         "first_in_forest"                
## [23] "first_year_data_set"             "first_year_data_set_test"       
## [25] "fy_retention_2018"               "fys_data_set"                   
## [27] "hsgpa_samdate"                   "ids"                            
## [29] "info_census_regions"             "info_continents"                
## [31] "instructors"                     "left_fy_vs_cohort_final"        
## [33] "living_learning_rec_history"     "living_learning_rec_history_raw"
## [35] "mag_scholars_merit_funds"        "oaa_combined"                   
## [37] "oaa_combined2"                   "parental_im"                    
## [39] "pre_ori_combined_retention"      "pre_orientation_camp"           
## [41] "retention_2018"                  "retention_camp"                 
## [43] "retention_final3"                "retention_final4"               
## [45] "retention2"                      "retention3"                     
## [47] "student_db_prep"                 "super_test"                     
## [49] "term_intervals"                  "test"                           
## [51] "xacad_support"                   "xadmissions"                    
## [53] "xbid_data"                       "xbirthdays"                     
## [55] "xcampus_rec"                     "xcensus"                        
## [57] "xcensus_stats"                   "xces"                           
## [59] "xcommunities"                    "xcourse_hist"                   
## [61] "xdemographics"                   "xdeposits"                      
## [63] "xdiscipline"                     "xdiscipline_record"             
## [65] "xdivisionals"                    "xdonors"                        
## [67] "xemployees"                      "xeureca"                        
## [69] "xfinaid"                         "xfinaid_new"                    
## [71] "xfinal_dest"                     "xfirst_payments"                
## [73] "xfr_cohort"                      "xfys"                           
## [75] "xgeocoded"                       "xgraduation"                    
## [77] "xgre"                            "xgreek"                         
## [79] "xgreek_checking"                 "xhome_value"                    
## [81] "xhousing"                        "xhs_gpa"                        
## [83] "xim"                             "xinvolvement"                   
## [85] "xletters"                        "xmag_scholars"                  
## [87] "xparents"                        "xpre_orientation"               
## [89] "xpre_orientation_format"         "xsurvey"                        
## [91] "xswipes"                         "xtransfer_student_data"         
## [93] "xwri111"                         "y2_cohorts"                     
## [95] "yielddata_2"

Additionally, it can be read in using wfu_getdata.

## # A tibble: 3 x 2
##      id grade
##   <dbl> <chr>
## 1     1 A    
## 2     2 B    
## 3     3 C

This can be useful if you need to write data that can be used over and over again. However, for consistency it might be better to write the data set in SAS so that it can be opened by both R and SAS.