[R] data frame returned from sapply but vector expected

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Fri Nov 4 13:36:46 CET 2022

On Fri, 4 Nov 2022 15:30:27 +0300
Ivan Krylov <krylov.r00t using gmail.com> 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
functions in to-be-library code.

Sorry for the double-post!

Best regards,

More information about the R-help mailing list