how to realize countifs function (excel) in R

前端 未结 5 949
面向向阳花
面向向阳花 2020-11-30 08:58

I have a dataset containing 100000 rows of data. I tried to do some countif operations in Excel, but it was prohibitively slow. So I am wondering if this kind o

5条回答
  •  广开言路
    2020-11-30 09:58

    library(matrixStats)
    > data <- rbind(c("M", "F", "M"), c("Student", "Analyst", "Analyst"))
    > rowCounts(data, value = 'M') # output = 2 0
    > rowCounts(data, value = 'F') # output = 1 0
    

提交回复
热议问题