读入纯文本型数据框
Use the read.table function, which returns a data frame:
公卫论坛
> dfrm <- read.table("filename.txt")To prevent read.table from interpreting character strings as factors, set the stringsAs
Factors parameter to FALSE:
公卫人
> dfrm <- read.table("statisticians.txt", stringsAsFactor=FALSE)
> class(dfrm$V1)
[1] "character"
If any field contains the string “NA”, then read.table assumes that the value is missing
公卫人
and converts it to NA. Your datafile might employ a different string to signal missing
values; if it does, use the na.strings parameter. The SAS convention, for example, is
公卫论坛
that missing values are signaled by a single period (.). We can read such datafiles like
this:
> dfrm <- read.table("filename.txt", na.strings=".")
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。