小编Min*_*yen的帖子

如何访问频率表中的值

我有一个频率表,计算向量中元素的频率

a = table(c(0,1,1,1,0,2,2,4,1,2,3,2,1,2,3,1,1,1,2,3,4,1,1,0))
a
#  0  1  2  3  4 
#  3 10  6  3  2
Run Code Online (Sandbox Code Playgroud)

我知道我可以通过名字(a)访问该名称.但是当我试图访问SECOND行的值时

a[1, "0"]
# Error in a[1, "0"] : incorrect number of dimensions

a[1, 1]
# Error in a[1, 1] : incorrect number of dimensions
Run Code Online (Sandbox Code Playgroud)

r r-table

8
推荐指数
1
解决办法
5596
查看次数

标签 统计

r ×1

r-table ×1