我将下表作为txt
community its members
1 12 15 4 6
2 1 3 2
3 9 13 7 8 9
4 5 10 11 14
此信息保存在community.txt中,我试图将其导入R中:
library(igraph)
community_table <- read.table("~/Desktop/community.txt", header= FALSE, sep = "" )
并收到错误:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 1 did not have 6 elements
我如何在R中导入它!
非常感谢任何建议和帮助
答案 0 :(得分:1)
要在R中导入,请尝试:
community_table <- read.table("~/Desktop/community.txt", header= FALSE, sep = "",fill = TRUE )
如果您能够导入,请使用示例数据集,您尝试过的代码以及问题第二部分的预期输出单独提出问题。