R : Deleting columns where certain % of missing values

In R, we can calculate % of missing values with colMeans(is.na(test)) and then set logical condition to get logical values and then use it to delete columns.
final <- test[, colMeans(is.na(test)) <= .5]
Note : test is a data frame 

Best Online Course : R Programming


R Tutorials : 75 Free R Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "R : Deleting columns where certain % of missing values"

Post a Comment

Next → ← Prev