This question is not a duplicate because my data.frame does not have the same amount of NA values in all Columns and therefore the solution mentioned in that question does not work.
I have a data.frame with a lot of NA values and I would like to delete all cells (important: not rows or columns, cells) that have NA values. The original would look like this:
A B
1 NA
NA 2
2 NA
NA NA
NA NA
NA 4
3 5
The desired result would look like this:
A B
1 2
2 4
3 5
The number of columns would have to stay the same, but it does not matter if the values remain on the same rows. They can just be moved up.
I could image one could delete all cells with the condition NA (maybe with apply) and get the result. Or maybe a simple sorting ?
Thanks.
Update:
A B C
1 3
2
4 3
1 2
3 5
4
9
7 1