Hi Everyone,
I'm working on a thorny subsetting problem involving list of lists. I've put a dput of the data here: https://gist.githubusercontent.com/aronlindberg/b916dee897d051ac5be5/raw/a78cbf873a7e865c3173f943ff6309ea688c653b/dput I can get one intense of the element I want this way: > input[[67]]$content[[1]]$sha [1] "58cf43ecdc1beb7e1043e9de612ecc817b090f15" However, I need to use a lapply function to loop over all of the items of the list. I've tried something like this, but it doesn't work: get_shas <- function(input){ x <- sapply(input, "[[", "content") y <- sapply(x, "[[", "sha") return(y) } sha_lists <- lapply(commit_lists, get_shas) However, this doesn't work. When I run each of the lapply commands "manually" it returns NULL for every list, and when I run the whole apply function it says: Error in FUN(X[[1L]], ...) : subscript out of bounds I've tried reading the sections on lists and subsetting in Hadley's Advanced R, but I still cannot figure it out. Can anyone help or offer a pointer? Best, Aron -- Aron Lindberg Doctoral Candidate, Information Systems Weatherhead School of Management Case Western Reserve University aronlindberg.github.io [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.