Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread Aron Lindberg
Thanks Chuck and Rolf. While Rolf’s code also works on the dput that I actually gave you (a smaller subset of the full dataset), it failed to work on the larger dataset, because there are further exceptions: input[[i]]$content[[1]] is sometimes a list, sometimes a character vector, and

Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread Aron Lindberg
Hmm…Chuck’s solution may actually be problematic because there are several entries which at the deepest level are called “sha”, but that should not be included, such as: input[[67]]$content[[1]]$commit$tree$sha and input[[67]]$content[[1]]$parents[[1]]$sha it’s only the “sha”

Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread Bert Gunter
How can you expect a solution if you cannot specify the problem? -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Fri, Feb 20, 2015 at 6:13 AM, Aron Lindberg

Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread Charles C. Berry
On Fri, 20 Feb 2015, Aron Lindberg wrote: Hmm…Chuck’s solution may actually be problematic because there are several entries which at the deepest level are called “sha”, but that should not be included, such as: input[[67]]$content[[1]]$commit$tree$sha and

Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread David Winsemius
On Feb 20, 2015, at 6:13 AM, Aron Lindberg wrote: Hmm…Chuck’s solution may actually be problematic because there are several entries which at the deepest level are called “sha”, but that should not be included, such as: input[[67]]$content[[1]]$commit$tree$sh and

Re: [R] Subsetting a list of lists using lapply

2015-02-20 Thread William Dunlap
The elNamed(x, name) function can simplify this code a bit. The following gives the same result as David W's get_shas() for the sample dataset provided: get_shas2 - function (input) { lapply(input, function(el) elNamed(elNamed(el, content)[[1]], sha)[1]) } Bill Dunlap TIBCO

[R] Subsetting a list of lists using lapply

2015-02-19 Thread Aron Lindberg
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

Re: [R] Subsetting a list of lists using lapply

2015-02-19 Thread Rolf Turner
On 20/02/15 08:45, Aron Lindberg wrote: Hi Everyone, I'm working on a thorny subsetting problem involving list of lists. If you think this is thorny you ain't seen nothin' yet! But note that you've got a list of lists of lists ... i.e. the nesting is at least 3 deep. I've put a dput of

Re: [R] Subsetting a list of lists using lapply

2015-02-19 Thread Charles Berry
Aron Lindberg aron.lindberg at case.edu writes: 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/