R: count number of distinct values in a vector

numbers <- c(4,23,4,23,5,43,54,56,657,67,67,435,
         453,435,324,34,456,56,567,65,34,435)

a <- table(numbers)

a


a[names(a)==435]

as.data.frame(table(numbers))

sum(numbers == 435)

posted @ 2014-01-17 18:51  emanlee  阅读(1804)  评论(0编辑  收藏  举报