0
A
回答
0
这可以通过使用ncol()和max()函数来完成,如图所示。一旦获得列索引号,可以提取如下:
X = matrix (1:12, nrow = 4, ncol=3)
#Let soln be the solution vector that stores the corresponding maximum value of each column
soln=c()
#Traverse the matrix column-wise
for (i in 1:ncol(X))
{
#Extract all rows of the ith column and find the maxiumum value in the same column
soln[i]= max(X[,i])
print(soln[i])
}
#Print the solution as a vector
soln
此外,类似的问题被回答here,不使用for循环(通过使用apply()函数)。
相关问题
- 1. 我怎样才能获得rsquare出ANOVA在R中
- 2. 我怎样才能获得列表框
- 3. 我怎样才能获得值“111”
- 4. 我怎样才能获得actionName在ActionFilter
- 5. 我怎样才能获得访问Android
- 6. 我怎样才能获得价值? Odoo
- 7. 我怎样才能得到
- 8. 我怎样才能找到在R
- 9. 我怎样才能
- 10. 我怎样才能在我的程序中获得_GLOBAL_OFFSET_TABLE_地址?
- 11. 怎样才能获得一个列表?
- 12. 怎样才能获得价值PreferenceFragment
- 13. 我怎样才能得到Parsley.js
- 14. 我怎样才能得到父组件
- 15. 我怎样才能得到屏幕-Android
- 16. 我怎样才能得到djangocms
- 17. 我怎样才能得到一个TD
- 18. 我怎样才能得到android
- 19. 我怎样才能得到statechange
- 20. 我怎样才能得到NSScrollView尊重
- 21. 我怎样才能得到用户
- 22. 我怎样才能从字符串中获得几个字符?
- 23. 我怎样才能在cs页面中获得动态gridview
- 24. 我怎样才能获得代理与shape文件中的NetLogo
- 25. 我怎样才能在app.config中获得log4net标记的值?
- 26. 我们怎样才能获得基于UNIX中
- 27. 我怎样才能在python中获得符号的平方根?
- 28. 我怎样才能在wpf mediaplayer中获得计时器
- 29. 我怎样才能在GTK中从Glade获得文本输入?
- 30. 我怎样才能获得设备ID为android系统中
非常感谢你,Sukriti – Elwakdy