2022 1:37 PM
> To: PIKAL Petr
> Cc: R-help Mailing List
> Subject: Re: [R] data frame returned from sapply but vector expected
>
> On Fri, 4 Nov 2022 15:30:27 +0300
> Ivan Krylov wrote:
>
> > sapply(mylist2, `[[`, 'b')
>
> Wait, that would simplify t
On Fri, 4 Nov 2022 15:30:27 +0300
Ivan Krylov wrote:
> sapply(mylist2, `[[`, 'b')
Wait, that would simplify the return value into a matrix when there are
no NULLs. But lapply(mylist2, `[[`, 'b') should work in both cases,
which in my opinion goes to show the dangers of using simplifying
function
On Fri, 4 Nov 2022 12:19:09 +
PIKAL Petr wrote:
> > str(sapply(mylist2, "[", "b"))
>
> List of 3
>
> $ : NULL
>
> $ :'data.frame': 5 obs. of 1 variable:
>
> ..$ b: num [1:5] 0.01733 0.46055 0.19421 0.11609 0.00789
>
> $ :'data.frame': 5 obs. of 1 variable:
>
> ..$ b:
Hallo all
I found a strange problem for coding if part of list is NULL.
In this case, sapply result is ***list of data frames*** but if there is no
NULL leaf, the result is ***list of vectors***.
I tried simplify option but it did not help me neither I found anything in
help page.
The
4 matches
Mail list logo