use                 package:epicalc                 R Documentation

_C_o_m_m_a_n_d _t_o _r_e_a_d _i_n _a_n_d _a_t_t_a_c_h _d_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     Command to read in data from Stata, SPSS, EpiInfo and .csv formats
     in addition to any R data frame

_U_s_a_g_e:

     use(filename, dataFrame = .data, clear = TRUE, tolower = TRUE)

_A_r_g_u_m_e_n_t_s:

filename: a character object ending with one of the following: .dbf,
          .dta, .sav, .rec, .csv (file with comma and header); data
          frames in R requires no quote

dataFrame: destination data frame where the read object is store

   clear: equal to 'detachAllData()' before reading in the data set and
          attaching it to the search path

 tolower: whether all the names of the variables should be forced to
          lower case (only if the original file has one the following
          extensions: '.dbf', 'rec' and '.sav')

_D_e_t_a_i_l_s:

     'use' reads in datasets from Dbase (.dbf), Stata (.dta),
     SPSS(.sav), EpiInfo(.rec) and Comma separated value (.csv) formats
     as well as R data frames. The destination data frame is saved in
     memory, by default as '.data', and automatically attached to the
     search path. This setting is the basis for other commands of
     'epicalc' including 'des', 'summ', 'recode', 'label.var' etc. 

     The 'use' command overwrites the destination data frame ('.data')
     with the new one.

_A_u_t_h_o_r(_s):

     Virasakdi Chongsuvivatwong <cvirasak@medicine.psu.ac.th>

_S_e_e _A_l_s_o:

     'read.table', 'read.dta', 'read.SPSS', etc and 'detachAllData'

_E_x_a_m_p_l_e_s:

     # data(BOD)
     library(foreign)
     write.dta(BOD, file="BOD.dta")
     rm(list=ls())
     ls()
     use("BOD.dta", clear=FALSE)

     # The above lines write Stata format from R data frame. 
     # In reality, one just types 'use("filename.dta")', if the file is available.
     des()
     file.remove("BOD.dta")

     # A better way to read an R dataset for exploration with Epicalc is
      use(BOD, clear=FALSE)
      des()
      summ()

