I have below matrix: I want to count number of "at".
q [1] "Meanwhile" "RBI" "on" "Tuesday" "kept"
[6] "the" "repo" "rate" "at" "which"
[11] "it" "lends" "to" "the" "system"
[16] "unchanged" "at" "7.25" "and" "the"
[21] "cash" "reserve" "ratio"
Now the problem here is that "at" is part of "rate" and "ratio". So when I do pattern search using
s=str_detect(q, fixed(q[i], TRUE))
or s=grepl(q[i], q,fixed=TRUE)
I get answer as 4. This includes ratio and rate. Not sure what to do in this case?
Aucun commentaire:
Enregistrer un commentaire