Remove column values with NA in R -


i have data frame, called gen, represented below

           b       c       d       e 1    na      4.35    35.3    3.36    4.87 2    45.2    .463    34.3    na      34.4 3    na      34.5    35.6    .457    46.3 

i remove columns there na's. (i know na.omit rows, can't seem find 1 columns). final result read:

     b       c       e 1    4.35    35.3    4.87 2    .463    34.3    34.4 3    34.5    35.6    46.3 

thanks!

gen <- gen[sapply(gen, function(x) all(!is.na(x)))] 

Comments

Popular posts from this blog

android - Inheriting from Theme.AppCompat* -

broadcastreceiver - android BOOT_COMPLETED not received if not activity intent-filter -

basic authentication with http post params android -