[R] Sequential Filtering of a Data Set

Lorenzo Isella |orenzo@|@e||@ @end|ng |rom gm@||@com
Fri Apr 26 16:51:28 CEST 2019


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



More information about the R-help mailing list