你必須定義一個分隔符,否則[R無法正確讀取數據。假設你的數據結構如下:
structure(list(month = 2:5, titles_tmp = structure(c(1L, 1L,
1L, 1L), .Label = "some text", class = "factor"), info_tmp = structure(c(1L,
1L, 1L, 1L), .Label = "More text", class = "factor"), unlist.text = structure(c(1L,
1L, 1L, 1L), .Label = "http://somelink.com", class = "factor")), .Names = c("month",
"titles_tmp", "info_tmp", "unlist.text"), class = "data.frame", row.names = c(NA,
-4L))
這意味着你用單個選項卡分隔每列。意思是你需要使用sep = " "
作爲數據分隔符。前提是你的數據文件名稱是「df.csv」下面應該很好地導入您的數據:
df = read.csv("Sz-Iraki2.csv", sep= " ", fileEncoding = "UTF-8")
您可能需要明確定義字段分隔符。如果該字段分隔符也出現在未加引號的字段中,則可能導致您看到的錯誤。 – 67342343
如果它是一個csv文件,也許你應該嘗試'read.csv'。如果錯誤仍然存在,請嘗試使用參數'fill = TRUE'。 –