Let's say I have a dataframe that looks like this:
variable1 <- c(1,1,1,0,1,0)
variable2 <- c(0,0,0,1,1,0)
variable3 <- c(1,0,1,0,1,1)
df <- data.frame(variable1, variable2, variable3)
What is the easiest way to get a dataframe output that looks like this:
Variable Total
Variable1 4
Variable2 2
Variable3 3
colsums
kind of gets me there, but the variable names aren't output as a legitimate column using this method.