Condensing Rows with NAs in a Dataframe (R)

Viewed 68

So I have a dataframe

mydf

            Pro1    Pro2    Pro3    Pro4
Pathway1    Woot    <NA>    Yeet    Yike
Pathway2    Dang    <NA>    <NA>    Yike
Pathway3    Blah    Try     <NA>    Lost

And I wan't to compress the NA's so it looks like this

revisedmydf

            Pro1    Pro2    Pro3    Pro4
Pathway1    Woot    Yeet    Yike
Pathway2    Dang    Yike
Pathway3    Blah    Try     Lost

Basically, the NA's are deleted and then the information in the column next to it is pulled into it's space. I have no idea how to approach this and am not sure if I titled this question correctly or am using the correct terminology. So, if this is a duplicate question out there, I apologize.
Best!

1 Answers
Related