It would be better to provide code to generate a suitable table than to show a literal table, as that is very inconvenient to recreate in an R session. Below I create randomly a small table consisting of only 1 and 0 values.
# Randomly generated selection columns
DF <- as.data.frame(matrix(sample(c(0,1), 30, replace=TRUE), ncol=3))
names(DF) <- c('uni1', 'uni2', 'uni3')
# Randomly generated info column
DF[["prod"]] <- sample(seq(11,999), 10)
## uni1 uni2 uni3 prod
## 1 0 1 1 935
## 2 0 0 1 116
## 3 0 1 1 707
## 4 0 0 1 434
## 5 1 0 0 537
## 6 0 0 0 443
## 7 0 0 1 525
## 8 1 0 1 979
## 9 0 0 1 360
## 10 0 0 1 975
Now to the main question. You can filter table rows like this: DF[(DF$uni1 == 1), ], and you can repeat the process for every uni by using the apply() family of functions. I chose 'vapply()' as the return of each iteration is a single value.
Here is how these three go together:
# Repeated for all columsn except the last
res <- vapply(names(DF)[1:length(DF)-1],
function(x) {
mean(DF[(DF[[x]] == 1), "prod"])
},
numeric(1) )
## uni1 uni2 uni3
## 758.000 821.000 628.875
The result is a named vector. You can then assign it to a column of a table.