如何将元数据附加到R中的列?

时间:2013-08-26 18:40:49

标签: r metadata

我正在尝试将元数据附加到R中的列。我有一个大型数据集,并希望通过注释在R中提取元数据信息(或者在某个地方更合适?)。我将元数据键入单个单元格中的单个单元格中,并且在定义注释时尝试引用它们。

我尝试了以下内容:

comment(data$cat)=as.quoted(metadata$catdot)
comment(data$cat)
# NULL

下一个我试图在我想要引入的文本中加上引号

comment(data$cat)=as.quoted(metadata$cat)
# Error in parse(text = x) : <text>:1:5: unexpected symbol
# 1: how many
   ^

使用引号的另一种尝试。请忽略这些愚蠢的文字,我只是用数据集和我编写的元数据测试代码

comment(data$place)=metadata$placequote
# Error in `comment<-`(`*tmp*`, value = list("whether the location is a shelter or a foster home because that is really important the poor little dogs and cats just don't have anywhere else to go maybe they are blind or starving and it's really just such a shame")) : 
# attempt to set invalid 'comment' attribute

comment(data$place)=readChar(metadata$place,nchars=81)
# Error in readChar(metadata$place, nchars = 81) : 
# cannot read from this connection

comment(data$place)=paste(readLines(metadata$place), collapse=" ")
# Error in readLines(metadata$place) : 'con' is not a connection

0 个答案:

没有答案