[R] Extracting data from list of lists of dataframes

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu May 28 04:03:36 CEST 2020


?reproducible example (see posting guide below)
or
https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

However, I would suggest that you spend some time with an R tutorial or two
rather than flailing about with such queries here.  R has basic tools --
indexing by logical expressions, for example -- for such tasks that you
seem completely ignorant about.  You would do better to invest the time to
learn them. Just my opinion of course. Feel free to ignore.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, May 27, 2020 at 6:38 PM H <agents using meddatainc.com> wrote:

> I am a newcomer to R and have been struggling with the following problem:
>
> I have a list1(1:N) containing a list2(1:2) each containing dataframes
> with the same column names but different number of rows. Both lists are
> named and the rows and the columns in the dataframe are named. I then would
> like to use select() and filter() on the dataframes to select data.
>
> I would like to: (1) select among the top-level lists, (2) select among
> the second-level lists and (3) finally use select() and filter() on the
> dataframe data.
>
> My attempt so far is:
>
> list1[grepl("myfirstselection", names(list1)][grepl("mysecondselection",
> names(list1[[]]))]
>
> Needless to say it does not work... And, I have not even gotten to the
> dataframes yet... ;-)
>
> ______________________________________________
> R-help using 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list