how do achieve the equivalent of awk '{print $1}' /tmp/data | sort | uniq -c for a particular column in R?
Example: cat /tmp/data
alama 
alama
a开发者_JAVA技巧lama
bbbb
bbbb
ccc
alama
bbbb
bbbb
awk '{print $1}' /tmp/data | sort | uniq -c
1 4 alama 4 bbbb 1 ccc
i.e. count of every item in the column.
Based on @Joshua's suggestion and my particular needs ...
s<-data.frame(table(spam[,1]))
p<-s[s$Freq>=3,]
p[order(p$Freq,decreasing=TRUE ),]
> set.seed(21)
> Data <- data.frame(V1=sample(letters[1:5],20,TRUE))
> length(unique(Data[,1]))
[1] 5
Based on your updated question -- assuming data is in x:
> table(x)
x
alama  bbbb   ccc 
    4     4     1 
> data.frame(table(x))
      x Freq
1 alama    4
2  bbbb    4
3   ccc    1
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论