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
grep command can be used
CA = mydata[grep("CA", mydata$sCode, ] nrow(CA)
CA = mydata[grep("CA", mydata$sCode, ]
nrow(CA)
to get the number of observations the number of rows from your Dataset would be more valid:
nrow(dat[dat$sCode == "CA",])