i need your help, i have a data frame like this
int x y z 1 0 1 0 2 1 0 0 3 0 0 1
and the result that i need must be like thi
A solution to this similar question.
tdf <- data.frame( A = c(1,1,0,0), B = c(0,0,1,0), C = c(0,0,0,1) ) library(magrittr) tdf %>% lapply(sum) %>% (function(x){ a <- c() for(i in 1:length(x)){ a <- c(a, rep(names(x[i]), x[i])) } return(a) })