最近才發生這種情況,我無法理解如何解決。注:我使用rStudio v0.99.893R(rStudio):查看錯誤的'名稱'屬性[4]必須與向量[1]的字符向量長度相同
我創建從data.table
一個特徵向量,然後我試圖查看,並收到上述錯誤: Error in View : 'names' attribute [4] must be the same length as the vector [1]
原來DT有12個變量〜萬點意見,這裏是一個集捕捉所有類:
> head(DT, 3)
HQ URL type ID1 ID2 completion date_first
1: imag image-welcome basic 444 24 0.1111111 2016-01-04 14:55:57
2: imag image-welcome basic 329 12 0.2222222 2016-03-15 11:37:21
3: imag image-confirm int 101 99 0.1111111 2016-01-06 20:55:07
as.character(sapply(DT, class))
[1] "character" "character" "character" "integer"
[5] "integer" "numeric" "c(\"POSIXct\", \"POSIXt\")"
從DT
我創建的URL
唯一值的特徵向量感興趣的子集(僅適用於「IMAG」 HQ):
URL.unique <- unique(DT[HQ == "imag", URL])
> class(URL.unique)
[1] "character"
> names(URL.unique)
NULL
> View(URL.unique)
Error in View : 'names' attribute [4] must be the same length as the vector [1]
> length(URL.unique)
[1] 262
印刷URL.unique
在控制檯做工精細,如通過write.table()
做出口,但很煩人,我無法查看。
除非上述內容有一些隱含的錯誤,否則我正在重新安裝rStudio。我已經嘗試過退出並重新啓動,以防萬一出現一些問題,因爲我傾向於在計算機上打開多個項目幾天。
任何幫助,將不勝感激!
這聽起來像你應該採取RStudio github頁面上的問題跟蹤器。 –
我懷疑重裝會有幫助;看起來像是他們所做的設計決定/缺陷。儘管你可以'View(data.frame(u = URL.unique))'。 – Frank
你也可以使用'utils :: View'按@gung的答案建議http://stackoverflow.com/a/19346803 – Frank