Reputation: 904
How would I use R to determine the number of times the word "RED" occurs in the following array:
test <- c("RED","WHITE","RED","RED")
Upvotes: 0
Views: 40
Reputation: 7190
Here is my answer:
sum(test == "RED") [1] 3
Upvotes: 1