Count number of rows matching a criteria

后端 未结 8 873
渐次进展
渐次进展 2020-11-29 05:01

I am looking for a command in R which is equivalent of this SQL statement. I want this to be a very simple basic solution without using complex functions OR dplyr type of pa

相关标签:
8条回答
  • 2020-11-29 05:40

    grep command can be used

    CA = mydata[grep("CA", mydata$sCode, ]

    nrow(CA)

    0 讨论(0)
  • 2020-11-29 05:43

    to get the number of observations the number of rows from your Dataset would be more valid:

    nrow(dat[dat$sCode == "CA",])
    
    0 讨论(0)
提交回复
热议问题