use {epicalc}R Documentation

Command to read in and attach data

Description

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

Usage

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

Arguments

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
spss.missing whether the values planned for missing for the SPSS dataset should be replaced with NA
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')

Details

'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.

Author(s)

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

See Also

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

Examples

# 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()

[Package epicalc version 2.10.1.1 Index]