[R] Sequential Filtering of a Data Set

Ek Esawi e@@w|ek @end|ng |rom gm@||@com
Sat Apr 27 16:25:51 CEST 2019


Hi

If i understand your question correctly, it seems split or split date
will do what you want.

BOL--EK

On Fri, Apr 26, 2019 at 10:51 AM Lorenzo Isella
<lorenzo.isella using gmail.com> wrote:
>
> Dear All,
> I must be drowning in a glass of water.
> Consider the following data set
>
> tt2<-structure(list(year = c(2000, 2001, 2002, 2003, 2004, 2005, 2006,
> 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
> 2018), country = c("DE", "DE", "DE", "DE", "DE", "DE", "DE",
> "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE", "DE",
> "DE"), berd = c(35600, 36331.9, 36950, 38029, 38363, 38651.038,
> 41148, 43034, 46073, 45275, 46929, 51077.2, 53790.1, 53566.2,
> 56996.5, 60952, 62826, 68644, NA)), row.names = c(NA, -19L), class = c("tbl_df",
> "tbl", "data.frame"))
>
>
> I would like to obtain a list of it, where every element of the list
> contains the subset of tt2 for which year>=2000,
> year>=2001....year>=2018 etc...
> It seems something I can tackle with map or map2 from purrr, but so
> far I am banging my head against the wall.
> Anyone can help me?
> Regards
>
> Lorenzo
>
> ______________________________________________
> 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.



More information about the R-help mailing list