This should do what you want:
set.seed(1)
# cerating a vector with comments, in which d's will be counted
comments<-character(25)
for (i in 1:25) {
comments[i] <- paste(sample(letters[1:10], 10, replace=T), collapse="")
}
# creating a vector to cross -tabulate
age <-sample(c("old", "young"), 2
ng),gender)
Hope that helps,
Daniel
-
cuncta stricte discussurus
-
-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von w_poet
Gesendet: Sunday, September 20, 2009 11:58 AM
An: r-help@r-project.org
Betreff: [R] how to co
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
3 matches
Mail list logo