Let´s say I have a list in R:
a <- c(1,2,3)
f <- NULL
b <- c("a","b","c")
d <- list(a,f,b)
yielding
> d
[[1]]
[1] 1 2 3
[[2]]
NULL
[[3]]
[1] "a" "b" "c"
I know it sounds dumb to build a list like this, but I get this from a previous computation (I could have set f to be 0 or any other character). I tried to remove f since I need the algorithm to perform operations in valid columns a and b, but unsuccessfully so far. d[2] is still there...
So how do I remove d[2] from the list? It should go from length = 3 to length = 2, and in the real instance I don´t know beforehand which elements of the list are NULL, so an if-based response would be great...
Cheers,