My data frame looks like this:
c1 c2 c3 c4
T1 NA NA NA
NA a NA NA
NA NA B NA
NA NA NA b
T2 NA NA NA
NA NA C NA
NA NA NA c
I want to have it like
c1 c2 c3 c4
T1 a B b
T2 NA C c
I tried with something like the following, which I saw from another post, but I don't think it applies to my problem, any help please?
stri_list2matrix(lapply(., function(x) x[x!='NA']), fill='', byrow=FALSE)