2016-05-04 403 views
1

最近才發生這種情況,我無法理解如何解決。注:我使用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。我已經嘗試過退出並重新啓動,以防萬一出現一些問題,因爲我傾向於在計算機上打開多個項目幾天。

任何幫助,將不勝感激!

+2

這聽起來像你應該採取RStudio github頁面上的問題跟蹤器。 –

+1

我懷疑重裝會有幫助;看起來像是他們所做的設計決定/缺陷。儘管你可以'View(data.frame(u = URL.unique))'。 – Frank

+0

你也可以使用'utils :: View'按@gung的答案建議http://stackoverflow.com/a/19346803 – Frank

回答

1

正如@Jonathan所指出的,這是目前與RStudio一起提交的調查報告。可以確認重裝和其他措施確實不是解決仍然存在的問題。如果它被複制並作爲錯誤提交,我會要求@Jonathan在此處提供其他人的詳細信息。

View(data.frame(u = URL.unique))解決方法做工作,推出觀衆感興趣的數據對象(感謝@Frank)上

0

我使用View(as.matrix(df$col_name)),它似乎運作良好。

相關問題