SAScii-package(SAScii)
SAScii-package()所属R语言包:SAScii
Import ASCII files directly into R using only a SAS input script
ASCII文件直接导入到R只用一个SAS输入脚本
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Using importation code designed for SAS users to read ASCII files into sas7bdat files, the SAScii package parses through the INPUT block of a (.sas) syntax file to design the parameters needed for a read.fwf() function call. This allows the user to specify the location of the ASCII (often a .dat) file and the location of the .sas syntax file, and then load the data frame directly into R in just one step.
的SAScii包解析使用输入代码读出ASCII文件到sas7bdat文件的SAS用户设计的,通过输入数据块的语法文件(SAS)设计的read.fwf()函数调用所需的参数。这允许用户指定位置的ASCII文件(通常是一个DAT)的位置。SAS语法文件,然后加载到R的数据框直接在短短的一个步骤。
Details
详细信息----------Details----------
(作者)----------Author(s)----------
Anthony Joseph Damico
Maintainer: Anthony Joseph Damico <ajdamico@gmail.com>
实例----------Examples----------
## Not run: [#不运行:]
##Load the 2009 Medical Expenditure Panel Survey Emergency Room Visits file as an R data frame[#载入2009年的医疗费用小组调查急诊室访问文件作为R的数据框]
#Location of the ASCII 2009 Medical Expenditure Panel Survey Emergency Room Visits File[2009年的ASCII医疗费用小组调查急诊室的位置访问文件]
MEPS.09.ER.visit.file.location <-
"http://meps.ahrq.gov/mepsweb/data_files/pufs/h126edat.exe"
#Location of the SAS import instructions for the[位置SAS进口的说明]
#2009 Medical Expenditure Panel Survey Emergency Room Visits File[2009年医疗费用小组调查的急诊室文件]
MEPS.09.ER.visit.SAS.read.in.instructions <-
"http://meps.ahrq.gov/mepsweb/data_stats/download_data/pufs/h126e/h126esu.txt"
#Load the 2009 Medical Expenditure Panel Survey Emergency Room Visits File[2009年医疗费用小组调查急诊室加载访问文件]
#NOTE: The SAS INPUT command occurs at line 273.[注意:发生在273线的SAS输入命令。]
MEPS.09.ER.visit.df <-
read.SAScii ( MEPS.09.ER.visit.file.location ,
MEPS.09.ER.visit.SAS.read.in.instructions ,
zipped = T ,
beginline = 273 )
#save the data frame now for instantaneous loading later[现在保存的数据框后瞬间加载]
save( MEPS.09.ER.visit.df , file = "MEPS.09.ER.visit.data.rda" )
##Load the 2011 National Health Interview Survey Persons file as an R data frame[#加载2011年全国健康访问调查人的文件作为一个R的数据框]
NHIS.11.personsx.SAS.read.in.instructions <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Program_Code/NHIS/2011/personsx.sas"
NHIS.11.personsx.file.location <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/NHIS/2011/personsx.zip"
#store the NHIS file as an R data frame[存储的NHIS文件作为一个R的数据框]
NHIS.11.personsx.df <-
read.SAScii (
NHIS.11.personsx.file.location ,
NHIS.11.personsx.SAS.read.in.instructions ,
zipped = T )
#or store the NHIS SAS import instructions for use in a [或在一个存储的的NHIS SAS进口的使用说明]
#read.fwf function call outside of the read.SAScii function[read.fwf以外的read.SAScii函数的函数调用]
NHIS.11.personsx.sas <-
parse.SAScii( NHIS.11.personsx.SAS.read.in.instructions )
#save the data frame now for instantaneous loading later[现在保存的数据框后瞬间加载]
save( NHIS.11.personsx.df , file = "NHIS.11.personsx.data.rda" )
##Load the 2011 National Health Interview Survey Sample Adult file as an R data frame[#载入2011年的全国健康访问调查样本成人文件作为一个R的数据框]
NHIS.11.samadult.SAS.read.in.instructions <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Program_Code/NHIS/2011/samadult.sas"
NHIS.11.samadult.file.location <-
"ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/NHIS/2011/samadult.zip"
#store the NHIS file as an R data frame![NHIS文件存储作为一个R的数据框!]
NHIS.11.samadult.df <-
read.SAScii (
NHIS.11.samadult.file.location ,
NHIS.11.samadult.SAS.read.in.instructions ,
zipped = T )
#or store the NHIS SAS import instructions for use in a[或在一个存储的的NHIS SAS进口的使用说明]
#read.fwf function call outside of the read.SAScii function[read.fwf以外的read.SAScii函数的函数调用]
NHIS.11.samadult.sas <-
parse.SAScii( NHIS.11.samadult.SAS.read.in.instructions )
#save the data frame now for instantaneous loading later[现在保存的数据框后瞬间加载]
save( NHIS.11.samadult.df , file = "NHIS.11.samadult.data.rda" )
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|