stata.get: Enhanced Importing of STATA Files

View source: R/misc.get.s

stata.getR Documentation

Enhanced Importing of STATA Files

Description

Reads a file in Stata version 5-11 binary format format into a data frame.

Usage

stata.get(file, lowernames = FALSE, convert.dates = TRUE,
          convert.factors = TRUE, missing.type = FALSE,
          convert.underscore = TRUE, warn.missing.labels = TRUE,
          force.single = TRUE, allow=NULL, charfactor=FALSE, ...)

Arguments

file

input SPSS save file. May be a file on the WWW, indicated by file starting with ‘⁠'https://'⁠’.

lowernames

set to TRUE to convert variable names to lower case

convert.dates

see read.dta

convert.factors

see read.dta

missing.type

see read.dta

convert.underscore

see read.dta

warn.missing.labels

see read.dta

force.single

set to FALSE to prevent integer-valued variables from being converted from storage mode double to integer

allow

a vector of characters allowed by R that should not be converted to periods in variable names. By default, underscores in variable names are converted to periods as with R before version 1.9.

charfactor

set to TRUE to change character variables to factors if they have fewer than n/2 unique values. Blanks and null strings are converted to NAs.

...

arguments passed to read.dta.

Details

stata.get invokes the read.dta function in the foreign package to read an STATA file, with a default output format of data.frame. The label function is used to attach labels to individual variables instead of to the data frame as done by read.dta. By default, integer-valued variables are converted to a storage mode of integer unless force.single=FALSE. Date variables are converted to R Date variables. By default, underscores in names are converted to periods.

Value

A data frame

Author(s)

Charles Dupont

See Also

read.dta,cleanup.import,label,data.frame,Date

Examples

## Not run: 
w <- stata.get('/tmp/my.dta')

## End(Not run)

Hmisc documentation built on June 22, 2024, 12:19 p.m.