removing columns when rows match a certain condition

7 Views Asked by At

I have a dataframe in the form of

  a <- c(NA, NA, 4, 1) 
  b <- c(NA, NA, 3, 4) 
  c <- c(3, NA, 5, 2) 
  d <- c(1:4)
  e <- c(1:4)
  
  df <- data.frame(a,b,c, d, e)

and would like to remove all columns which contain NA in the second row.

Is there a way to combine across and select to have them automatically removed?

Really appreciate your help.

0

There are 0 best solutions below