[R] how to count occurrences of string?

w_poet stephen.le at ucla.edu
Sun Sep 20 17:58:08 CEST 2009


Hi everyone,

I have an array with a variable called comments. I wish to count the number
of subjects whose post-experiment comments contain a string x and then cross
tab this with other variables of interest, ex. age. Does anyone have any
suggestions on how to count unique occurrences of a string embedded within a
variable and cross-tab it with other variables?

I've looked through the help files, etc. One method I tried was to use
strsplit to split comments. I can use this with table to count the number of
occurrences of x, but I can't cross tab this with other variables because
comments is a ragged array after being split.

Thanks in advance,

Stephen
-- 
View this message in context: http://www.nabble.com/how-to-count-occurrences-of-string--tp25530083p25530083.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list