import_data: Import Data

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ares.r

Description

Import datasets in different formats

Usage

1
import_data(file, text.format = "csv", ...)

Arguments

file

quoted string with the file name

text.format

rules for text files

...

further options for read.table

Details

The function will try to select the proper filter based on the file extension. Valid file types are some of those supported by package foreign. There are rules implemented for Stata up to version 9 (*.dta), SPSS up to version 11 (confirmed) (*.sav), xBase files up to version 4 (*.dbf), Epi-Info files version 6 (*.rec). R binary files *.rda can also be read directly by this function. Excel files (*.xls) are no longer supported. Please, save the files in the CSV format.

Several text formats can be read by setting text.format or passing options through .... If none of the above proprietary formats extension is part of the file name, the function will assume an ASCII text filter disregarding the extension. Available options for text.format are "csv" for comma separated values, "tab" for columns separated by a tab character and "spc" for space separated columns and, also, its variants for comma as the decimal separator, "csv2", "tab2" and "spc2".

If file is set to "clipboard" the function will try to import data previously copied into the system clipboard using text data rules set in text.format. It can render unexpected results though.

Value

An object of class data.frame.

Author(s)

Washington Junger wjunger@ims.uerj.br and Antonio Ponce de Leon ponce@ims.uerj.br

See Also

attach,search

Examples

1
2
3
data(admrio)
export_data(admrio,"admrio.dta")
new.data=import_data("admrio.dta")

wjunger/ares documentation built on Dec. 23, 2021, 5:17 p.m.