我尝试使用“#”作为字段分隔符来将文件读入数据框。但看起来R无法识别它。为什么我不能使用“#”作为字段分隔符?
谢谢
最佳答案
参见 ?read.table
。您需要更改 comment.char
参数,因为这会覆盖您将分隔符设置为 #
的尝试。
试试 read.table(foo.txt, sep = "#", comment.char = "")
设置 comment.char = ""
轮流解释注释(来自 ?read.table()
):
comment.char
: character: a character vector of length one containing a single character or an empty string. Use""
to turn off the interpretation of comments altogether.
关于r - "#"不能用作read.table 的字段分隔符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10280074/