如何在R中读取带有不规则空格的数字
我有我的数据在txt文件中,包含以下数字,如何读入R 我将如何在R中读取带有不规则空格的数字,r,R,我有我的数据在txt文件中,包含以下数字,如何读入R 我将fread绑在一起,但没有起作用 Error in fread("x.txt") : Expected sep (' ') but new line, EOF (or other non printing character) ends field 0 when detecting types ( first): 以下是数据: 2 3 3 2 1 2 3 2 3 2
fread
绑在一起,但没有起作用
Error in fread("x.txt") :
Expected sep (' ') but new line, EOF (or other non printing character) ends field 0 when detecting types ( first):
以下是数据:
2 3 3 2 1 2 3 2 3 2 1 3 1 2
1 1 3 2 3 1 2 1 2 3 3 2
3 1 1 1 2 1 1 3 1 2 2 2
1 3 1 1 3 2 3 3 1 1 2 2
1 3 2 3 2 1 3 1 1 1 3 1
1 3 1 2 3 3 2 2 2 2 3 3
1 3 2 3 2 3 2 2 2 1 3 1
3 2 1 2 2 3 3 2 3 2 3 3
2 1
试试这个
x <- scan("x.txt")
data <- as.data.frame(x)
x不清楚。您的示例中有多少行?