Fairly new to the R studio area (especially when it comes to loop commands)
Was wondering if someone can help me with a small problem.
I have a large file (800,000 rows). Data is vertical so each row represents an individual (personcode)
each row has a startdate and an end date.
There is an event which occurs for some individuals. Im trying to figure out the easiest way if the outcome happened between any of the start date/end date.
As an example
Personcode startdate enddate eventdate
1 01.01.2010 05.01.2010 10.10.2010
1 01.10.2010 15.10.2010
2 02.02.2012 10.09.2012
3 05.06.2014 06.06.2014 23.06.2014
3 02.02.2018 06.02.2018
3 04.06.2018 04.06.2018
Person 1 the event happened for that individual (in the second row) so the event would be a Yes. Person 2 never had an event. Person 3 had an event but they did not occur between any of the start and end dates for the individual. (I guess ideally a new column is created with Y or N to see if it matches my interest).
Can anyone direct me to a resource or a previous post which would help me with this problem?
Many thanks and much appreciated in advance