I have a data set, what looks approximately like the one below.
column1 column2 column3 column4
1 2 3 string 4
2 3 56 string 6
3 86 23 string 4
All of the columns have numeric values except column3.
I am trying to figure out the way how to count how many times the value in column3
was mentioned with a particular value from column4
. In other words, in this example, there are 2
values of string
with a value 4
.
For now, I've come up with a following code:
data$new_column = ifelse(data$column3=="string" && data$column4==4, "", "")
table(data$new_column)
But it gives me a total number of all the values, which is in example case 3
I have tried this solution: Counting the number of elements with the values of x in a vector, but it didn't help much as it gives me an error:
[ reached getOption("max.print") -- omitted x rows ]
What, as far as I understand, that this solution doesn't work on large datasets.
What would be the best way to realize this solution?
Thanks for the ideas in advance!