You can use [ with column names of data frames, as well as their index. So foo[4] will have the same result as foo["bias"] (assuming bias is the name of the fourth column).
$bias is not really the name of this column. $ is another function in R, for example [ , which is used to access columns of data frames (among other things).
But now I'm going to go on a limb and offer some recommendations on your data structure. If each element of your nested list contains data for a unique combination of station and member , here is a simplified version of the toys of your data:
dat <- expand.grid(station = rep(1:3,each = 2),member = rep(1:3,each = 2)) dat$bias <- sample(50:100,36,replace = TRUE) tmp <- split(dat,dat$station) tmp <- lapply(tmp,function(x){split(x,x$member)}) > tmp $`1` $`1`$`1` station member bias 1 1 1 87 2 1 1 82 7 1 1 51 8 1 1 60 $`1`$`2` station member bias 13 1 2 64 14 1 2 100 19 1 2 68 20 1 2 74 etc.
tmp is a list of length three, where each item itself is a list of length three. Each element is a data frame as shown above.
It is much easier to write data such as a single data frame. You will notice that I built it this way first ( dat ) and then split it twice. In this case, you can rbind put everything together using the following code:
newDat <- do.call(rbind,lapply(tmp,function(x){do.call(rbind,x)})) rownames(newDat) <- NULL
In this form, these types of calculations are much simpler:
library(plyr)
source share