如果我做
a = read.table(textConnection('a b c d
1 2 3 4
a b c
1 2 3 4','r'),header=T)
我收到一个错误
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 3 did not have 4 elements
如何让 R 用 NA 替换缺失的元素而不是因错误而失败?
如果我做
a = read.table(textConnection('a b c d
1 2 3 4
a b c
1 2 3 4','r'),header=T)
我收到一个错误
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 3 did not have 4 elements
如何让 R 用 NA 替换缺失的元素而不是因错误而失败?