6
A
回答
0
根據你在循環中做什麼,%in%
運算符返回一個向量的事實可能是一個問題;考慮一個簡單的例子:
c1 <- c("one","two","three","more","more")
c2 <- c("seven","five","three")
if(c1%in%c2) {
print("hello")
}
那麼以下警告:
Warning message:
In if (c1 %in% c2) { :
the condition has length > 1 and only the first element will be used
如果事情在你的if語句是依賴於要素的具體數量,以及它們不匹配,那麼它是可能獲得你看到的錯誤
9
在@Chris W的精神,只是嘗試複製你正在得到的確切的錯誤。一個例子就是有幫助,但也許你正在做的:
x <- c(1,2)
y <- c("a","b","c")
names(x) <- y
Error in names(x) <- y :
'names' attribute [3] must be the same length as the vector [2]
我懷疑你想給名字向量(x
)比你的名字的載體(y
)短。
-1
我看到了這樣的錯誤,我解決了它。您的數據集中可能缺少值。每列中的觀察數量也必須相同。
0
我強迫這個錯誤的錯誤是試圖重命名一個循環中的列,我不再選擇在我的SQL中。這也可能是由於您想要在計劃中進行選擇而嘗試做同樣的事情造成的。確保您試圖更改的列實際存在。
相關問題
- 1. 初始化我使用</p> <pre><code>vector<vector<size_t>> Ar; </code></pre> <p>結構矢量矢量
- 2. 推矢量<double>到矢量<矢量<double>>
- 3. 如何使HTML <a target='_parent'> point to the same as javascript window.opener?
- 4. 保存的<a href> in the localstorage
- 5. 命名空間聲明語句必須在腳本中使用</p> <pre><code>php artisan make:request TrainingRequest FatalErrorException in TrainingRequest.php line 3: Namespace declaration statement has to be the very first statement in the script </code></pre> <p>的第一個語句Laravel-5
- 6. make_pair矢量<矢量<struct>>
- 7. 迭代用於向量<矢量<對<長長,長長>>>
- 8. C++:矢量<對<vector<int>,INT>>
- 9. 錯誤</p> <blockquote> <p>ERROR: In ForegroundLinearLayout, unable to find attribute android:foregroundInsidePadding</p> </blockquote> <p>:foregroundInsidePadding
- 10. 傳遞矢量<reference_wrapper <int>>到矢量<int>?
- 11. 確實foreach(<$IN>)sl the文件?
- 12. 錯誤:</p> <blockquote> <p>Error: The "(" character, hexadecimal value 0x28, cannot be included in name</p> </blockquote> <p>我怎樣才能糾正這個問題:「(」字符,十六進制值0×28,不能用VB.NET列入名
- 13. print <<< HTML in php?
- 14. convert <vector><string> TO <vector><int> C++,Win32
- 15. <Error><main.c> in simple program
- 16. IIf(<condition>, <value>,ElseIf <condition>, <value>, <value>, <value>)表達無效
- 17. Grails <g:if> in <g:select>
- 18. 更快:新的矢量。 <T>或向量。 <T> .splice(0,Vector。<T> .length)?
- 19. qt #include <vector> error
- 20. JSF2 + <託管屬性><屬性名稱>
- 21. 傳遞矢量<shared_ptr的<Derived>>到功能期待矢量<shared_ptr的<Base>>
- 22. vector <string> or vector <vector <char>>?
- 23. 什麼做載體<vector<T...>>和矢量<vector<T>之間的區別......>
- 24. std :: vector <std :: vector <T>> vs std :: vector <T*>
- 25. openCV:將墊子保存到矢量<vector<int>>
- 26. 矢量< vector<int>>與6×6尺寸的實施
- 27. iterate std :: vector <std :: vector <char>>?
- 28. 「<<<<<<< HEAD」模板
- 29. 從矢量<string>轉換爲矢量<char*>至char **
- 30. git「<<<<<<< HEAD」
你能提供一個最小可重現的例子嗎? – Dason
是的,我強烈懷疑你已經指出了錯誤的線......所以需要更多的上下文!嘗試在錯誤發生後鍵入'traceback()'。 – Tommy
您是否檢查過此討論:http://stackoverflow.com/questions/14153092/meaning-of-ddply-error-names-attribute-9-must-be-the-same-length-as-the-vec –