read.dta(foreign)
read.dta()所属R语言包:foreign
Read Stata Binary Files
Stata的二进制文件
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Reads a file in Stata version 5–11 binary format into a data frame.
在Stata版本5-11二进制格式的文件读入数据框。
用法----------Usage----------
read.dta(file, convert.dates = TRUE, convert.factors = TRUE,
missing.type = FALSE,
convert.underscore = FALSE, warn.missing.labels = TRUE)
参数----------Arguments----------
参数:file
a filename or URL as a character string.
作为字符串的文件名或URL。
参数:convert.dates
Convert Stata dates to Date class?
Stata的日期转换Date类?
参数:convert.factors
Use Stata value labels to create factors? (version 6.0 or later).
使用Stata的价值创造因素的标签? (6.0或更高版本)。
参数:missing.type
For version 8 or later, store information about different types of missing data?
版本8或后,丢失数据的不同类型的存储信息呢?
参数:convert.underscore
Convert "_" in Stata variable names to "." in R names?
转换"_"在Stata变量名"."在R的名字吗?
参数:warn.missing.labels
Warn if a variable is specified with value labels and those value labels are not present in the file.
警告说,如果一个变量被指定与价值的标签和值标签是不存在的文件。
Details
详情----------Details----------
If the filename appears to be a URL (of schemes http:, ftp: or https the URL is first downloaded to a temporary file and then read. (https: is only supported on some platforms.)
如果文件名似乎是一个URL(计划http:,ftp:或https:)的网址是先下载到一个临时文件,然后读取。 (https:只在某些平台上的支持。)
The variables in the Stata data set become the columns of the data frame. Missing values are correctly handled. The data label, variable labels, and timestamp are stored as attributes of the data frame. Nothing is done with variable characteristics.
在Stata数据的变量设置成为列的数据框。正确处理缺失值。数据标签,标签变量,时间戳存储为数据框的属性。什么是可变的特点。
By default Stata dates (%d and %td formats) are converted to R's Date class and variables with Stata value labels are converted to factors. Ordinarily, read.dta will not convert a variable to a factor unless a label is present for every level. Use convert.factors = NA to override this. In any case the value label and format information is stored as attributes on the returned data frame.
默认情况下,Stata的日期(%d和%运输署格式)转换为R的Date类变量与Stata的值标签转换的因素。通常情况下,read.dta不会转换为变量的一个因素,除非标签是目前每一级。使用convert.factors = NA覆盖。在任何情况下,值标签和格式信息存储返回的数据框的属性。
Stata 8.0 introduced a system of 27 different missing data values. If missing.type is TRUE a separate list is created with the same variable names as the loaded data. For string variables the list value is NULL. For other variables the value is NA where the observation is not missing and 0–26 when the observation is missing. This is attached as the "missing" attribute of the returned value.
STATA 8.0系统介绍了27种不同的丢失的数据值。如果missing.type是TRUE加载的数据相同的变量名创建一个单独的列表。对于字符串变量列表中的值是NULL。其他变量的值是NA观察失踪和0-26观察时失踪。这是连接"missing"返回值的属性。
值----------Value----------
A data frame with attributes. These will include "datalabel", "time.stamp", "formats", "types", "val.labels", "var.labels" and "version" and may include "label.table". Possible versions are 5, 6, 7, -7 (Stata 7SE, "format-111"), 8 (Stata 8 and 9, "format-113") and 10 (Stata 10 and 11, "format-114"). Stata 12 by default uses "format-115", which is read as "format-114" (the Stata documentation says its structure is identical).
与属性数据框。这些措施包括"datalabel","time.stamp","formats","types","val.labels","var.labels"和"version"“可能包括<X >可能的版本是"label.table",5, 6, 7(Stata的7SE,“格式-111),-7(8日和9 Stata的格式-113)和8 (Stata的10日和11日,“格式-114)。默认使用的格式-115,这是读“格式-114”的Stata 12(Stata的文件说,它的结构是相同的)。
The value labels in attribute "val.labels" name a table for each variable, or are an empty string. The tables are elements of the named list attribute "label.table": each is an integer vector with names.
在属性值的标签"val.labels"每个变量的命名表,或者是一个空字符串。表元素命名的列表属性"label.table":每一个名字的整数向量。
作者(S)----------Author(s)----------
Thomas Lumley and R-core members
参考文献----------References----------
or online help (version 8 and later) describe the format of the files. Or at http://www.stata.com/help.cgi?dta and http://www.stata.com/help.cgi?dta_113.
参见----------See Also----------
A different approach is available in package memisc: see its help for Stata.file.
另一种方法是在包memisc:帮助Stata.file。
write.dta, attributes, Date, factor
write.dta,attributes,Date,factor
举例----------Examples----------
data(swiss)
write.dta(swiss,swissfile <- tempfile())
read.dta(swissfile)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|