Let’s say I have rows like this:
First, Last, Address, Address 2, Email, Custom1, Custom2, Custom3
1 A, B, C, D, E@E.com,1,2,3
2 A, , C, D, E@E.com,1,2,
3 , , , , E@E.com,1, ,
What I would like to to do is create a function that pulls that row which is most complete and I’m wondering if there are any packages or pre-existing methods (recommendations, even) for doing this. In the example above, I would like to to have a function that chooses row 1.
I can’t use complete.cases() or na.omit() because in many circumstances the cases are not complete and contain at least one NA. I’ve tried combining unique() with a number of specific pulls… but I’m not having much luck automating this manipulation task.
You can convert to character and the count row-wise how many non-emptys you have: