Hi here is an exemple of code of what you want. Note that you can use it, deform it to retrieve different aspect of your dataset.
# Reproduction of your dataset type (not a copy, sample is a random function).
# This is the kind of example it is nice to have in your question
df <- data.frame(Compassion = sample(c(1,0), 5, replace = TRUE),
relevance = sample(c(1,0), 5, replace = TRUE),
Time = sample(c(1,0), 5, replace = TRUE),
Exemplification = sample(c(1,0), 5, replace = TRUE),
credit = sample(c(1,0), 5, replace = TRUE),
Science = sample(c(1,0), 5, replace = TRUE),
Work = sample(c(1,0), 5, replace = TRUE),
Action = sample(c(1,0), 5, replace = TRUE),
Response = sample(c(1,0), 5, replace = TRUE),
efficient = sample(c(1,0), 5, replace = TRUE))
df
# The groups
g1 <- c("Compassion", "relevance", "Time", "Exemplification")
g2 <- c("credit", "Science", "Work")
g3 <- c("Action", "Response", "efficient")
# TRUE/FALSE on each group. As your data is coded in 0/1, a sum by row is efficient.
boolG1 <- rowSums(df[g1]) >= 1
boolG2 <-rowSums(df[g2]) >= 1
boolG3 <-rowSums(df[g3]) >= 1
# extract the rows where the sum is > to 0
df[boolG1 | boolG2 | boolG3,]
# Printing the number of rows, and changing the conditions
sprintf("number of tweet from 3 groups : %d", nrow(df[boolG1 | boolG2 | boolG3,]))
sprintf("number of tweet from 1st group : %d", nrow(df[boolG1,]))
sprintf("number of tweet from 2nd group : %d", nrow(df[boolG2,]))
sprintf("number of tweet from 3rd group : %d", nrow(df[boolG3,]))
# You can also extract percentage ?
paste0(sprintf("percentage of tweet from 3 groups : %d ",
nrow(df[boolG1 | boolG2 | boolG3,])/nrow(df)*100), "%")
You tried to do this with an if condition, it's okay but you'll need to put this in a for loop. R is more efficient when vectorising computation. There is more information in this article.
EDIT
Here is a small code to represent you dataset with a Venn diagram
library(VennDiagram) # you may need to install this package
venn.diagram(
x = list(g1 = which(boolG1),
g2 = which(boolG2),
g3 = which(boolG3)),
filename = 'venn_diagramm.tiff', # be aware it create a file !
)