I have a data.frame with mostly NA values and some data. To clean this up I need to just select and copy all NA values (not rows or columns including NAs, but just the values). This seemed like an easy task but no solution I tried so far did work. I want to make clear that I do not want to keep the numbers of rows intact in the resulting variable/file, but rather remove all NA values column by column individually. As if these columns where individual lists and I would sort all the cells to the top that contain information/values and all cell that are NA to the bottom.
Thank you.
Update example:
Col 1 Col 2 Col 3
Bar NA But
NA There NA
Foo NA NA
NA NA Not
NA NA NA
Here NA NA
NA Better NA
Desired result:
Col1 Col2 Col3
Bar There But
Foo Better Not
Here
I need to keep the columns intact, but within the columns all values should move up. Therefore if I can select all the non NA values and paste them into a new dataframe (or anything else), that contains the same amount of columns but only the values, no NAs.
Hope that makes it clearer. Thank you.