So my question doesn't sound quite right, but i don't how to formulate it more correctly.
I am trying to do the following. I have a dataframe which contains 3 columns, 2 of which can either have a 1 (yes) or a 2 (no). And 1 column that has either a 1,2 or 3. Now what I want to do is see which percentage has all 2 column on 1 and the 1 column on 1 or 2, which has all 2 column on 2 and the one column on 3, and which only has one of the 2 column on 1 and the one column on 1 or 2.
If you catch my drift?
for example df is:
V1 V2 V3
1 1 2 1
2 2 2 2
3 1 1 1
4 2 2 1
5 1 2 1
Of the 5 rows 1 has all on 1 (yes), so 20% would be all 1, so i'd expect my outcome to be something like this:
all 1: 20%
Sample of data with dput(DT)
structure(list(rom = c("2", "1", "2", "2", "2", "1", "2", "1",
"2", "2", "1", "1", "2", "2", "2", "1", "2", "2", "2", "2", "2",
"2", "2", "1", "2", "2", "2", "2", "1", "1", "2", "2", "2", "2",
"2", "1", "1", "1", "1", "2", "2", "2", "1", "1", "2", "2", "1",
"1", "2", "1", "1", "2", "2", "2", "2", "1", "1"), power = c("2",
"2", "2", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "1",
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
"2", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
"2", "2", "1", "2", "2", "2", "1", "2", "2", "2", "2", "2", "2",
"2", "2", "2", "2"), pain = c("2", "2", "3", "2", "2", "3", "2",
"2", "2", "2", "3", "2", "3", "2", "3", "3", "3", "3", "3", "3",
"2", "3", "3", "2", "3", "3", "2", "2", "2", "2", "3", "3", "3",
"3", "2", "2", "3", "2", "2", "2", "3", "3", "2", "2", "3", "2",
"2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "2")), row.names = c(NA,
-57L), class = "data.frame")