I have a character matrix with differing numbers of NA in different rows. I would like to create a structure that has the same number of rows, with all the NAs removed.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using a simple apply :
edit : if all rows have exactly the same amount of NA’s, then this will return a matrix. For conversion of this matrix to a list, see : How to convert a matrix to a list of column-vectors in R? .