Hi everyone! I am very new to R and I am having some difficulties. My data set looks something like this:
subject A B C D E 1 cat monkey cat dog cat 2 cat cat cat cat dog .... I want to create three new variables, that count the amount of "cat", "monkey" and "dog" per subject subject A B C D E cat dog monkey 1 cat monkey cat dog cat 3 1 1 2 cat cat cat cat dog 4 1 0 .... I have been looking at rowSums, rowsum, apply, grep, and doing some searches, but I can only find count for numerical values or NA values. Thanks in advance, L ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.