I am a novice R user and new to the forum. I have a data frame that I need to convert so that each row is a character vector. I want to remove the 0's from the data frame so that each row can have varying lengths. So in essence each row is a separate character vector in a list. Where I am at is the following:
mydf<-matrix(sample(0:1,12*5, replace = T),ncol =4)
colnames(mydf)<-letters[1:ncol(mydf)]
swapcol <-which(mydf == 1, arr.ind = T)
mydf[swapcol]<-colnames(mydf)[swapcol[,2]]
mydf
The code produces a data frame in which the column labels are values. I need the following output:
the format appears to be what I need in order to read in data to the package clickstream. Thanks