1 year ago

#351686

test-img

Richard

Opening up observations when given a frequency table

So I have a table and instead of having 12 rows of frequencies, I would like to expand the table to have include all 3303 observations (total of all frequencies).

I tried using pivot_longer but all I am getting is the same table with an added column. I could make a data frame for each observation with the total frequency for that observation minus 1 and rbind it to the dataset but that is 12 lines of code! Is there a simpler way?? Let us say the dataset = prostateca

dataset

pivot

frequency-distribution

0 Answers

Your Answer

Accepted video resources