I have a dataframe where data are sorted like that:
df <- data.frame('a'= c('b'), 'c'=c('d'), 'e'= c('f'), 'g'= c('h'), 'i'=c('j'))
df
# a c e g i
# 1 b d f h j
Is there a way that I can transform the dataframe, so data move one row down (lineary) for each column? Except from the first row where the value stays where it is:
df_expected <- data.frame('a'= c('b', '','','',''), 'c'=c('','d','','',''), 'e'= c('', '', 'f', '',''), 'g'= c('','','','h',''), 'i'=c('','','','','j'))
df_expected
# a c e g i
# 1 b
# 2 d
# 3 f
# 4 h
# 5 j