Hello everyone. I am very much a beginner with R and I am trying to turn the following if-then statement into R code. More detail. I want to create a new variable: "inperiod" that will be a numeric code. So if a specific event start date (StartDate) is greater or equal to a testing date (Beg1Date) AND the event end date (EndDate) is less than or equal to the testing date (Beg1Date), I want the inperiod code to be 1. I will do this for a range of dates so that the code can be anywhere from 1-25.
If StartDate >= Beg1Date & EndDate <= Beg1Date inperiod = 1. Thanks for any help. Zeda [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list 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.