我有 1-10、10-20、20-30、30-40 这样的组。我有像“1,23,24,11,33,22,5,6,7,8,3,2”这样的数据 我怎样才能知道每组有多少人
最佳答案
您还可以使用 hist 函数:
y <- c(1,23,24,11,33,22,5,6,7,8,3,2)
h <- hist(y, seq(0, 40, 10), plot=0) # plot=0 avoids plotting the histogram
# Refer to h$counts to get the counts in each bin
关于r - 在 R 中,如何将数据分配到不同的组中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2800704/