Remove an element from a list that contains only NA?

  • A+

I want to remove all elements in this list that contain only NA:

  List_data <- list("Green", "Yellow", c(NA,NA,NA), TRUE, 51.2) 


EDIT2: As per akrun's comment following may also help here.

List_data[vapply(List_data, function(x) any(!, logical(1))] 

EDIT: As per Onyambu's comment following may help in order to remove complete element which has NA in it, thanks to Onyambu for guiding here.

List_data[!sapply(List_data, function(x) all(] 

Could you please try following:

lapply(List_data, function(x) x[!]) 


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: