1

我正在加载一个表,其中第一列是一个 URL,并使用read.table().

似乎 R 正在删除大约 1/3 的列并且没有返回任何错误。

URL 不包含任何#字符或制表符(我的分隔符字段),我知道这可能是一个问题。如果我先将 URL 转换为整数 ID,问题就会消失。

是否存在可能导致 R 删除行的字段?

4

2 回答 2

2

没有数据样本,很难说。但是一个小“陷阱”#comment.char. read.table()尝试设置comment.char = ""并查看是否可以解决它。

于 2009-08-12T13:03:56.213 回答
1

Thanks for all your help,

Yes, so initially there were some hashes and I was able to handle them using comment.char = ''. The problem turned out to be that some of my URLs contained ' and " characters. The strangest thing about the situation is that it didn't return any errors. After I removed these characters using tr, I had no issues with loading the data.

于 2009-08-13T17:22:36.597 回答