I hope someone can help me find the right direction for my Problem Let's say we have a data frame like this
year | Plant |
---|---|
2009 | Monstera |
2010 | Monstera |
2011 | Monstera |
2012 | Monstera |
2014 | Monstera |
2009 | Pilea |
2010 | Pilea |
2011 | Pilea |
2011 | Philodendron |
2012 | Philodendron |
2013 | Philodendron |
I want to remove all rows of a plant if the year starts 2009 but want to stop if one year is skipped the final data frame should look like this
year | Plant |
---|---|
2014 | Monstera |
2011 | Philodendron |
2012 | Philodendron |
2013 | Philodendron |
I the forum I found some information on this problem in excel, however I can't get it to work since I'm an absolute programming and R beginner.
Here are my code Ideas which currently don't work
list1<-list(unique(plants))
For (i in list1){
if (dataset$year==2009){
while i
-[c(year==2009)]
....
break
} else {
....
I know its not much but I really tried and I hope someone can help
Thank you!