我是R的初学者。我在RStudio工作
使用以下函数导入数据集:
mydata <- read.table("dataset.txt",sep="\t",dec=",", h=T, row.names=1)
导入文件,我可以在RStudio中看到它。然后,我想查看我的数据:
table (column2, column3) # it does work and give me the table
一切看起来都不错。但是,如果我要求第一栏
table (column1, column2) # it doesn't work!
我收到了错误消息:
"Error in table(column1) : object 'ID_site' not found"
似乎第一列不属于我的数据集...
你知道为什么吗?在输入数据之前是否有选项可供选择?
答案 0 :(得分:2)
尝试从row.names=1
电话中删除read.table
部分。执行此操作时,R将获取数据集的第一列,并将其用作数据框的rownames。这反过来删除了列的ID,这就是为什么R说你的&#34; ID_site&#34;无法找到专栏。