I have this data format:
df<-data.frame(Value=c(0,1,2), A=c(3,2,0), B=c(1,4,2))
I want to get vectors with a distribution of my values ββfor each group (A, B), assuming that the numbers in each column correspond to the number of occurrences of each βvalueβ (data from a histogram). So, if I have 5 in column A for a value of 1, I want to have five 1 (1,1,1,1,1,1) in the vector result. In this example, the result would be:
A<-c(0,0,0,1,1) B<-c(0,1,1,1,1,2,2)
thanks
source share