Re: [R] If-then with Dates in Date Ranges

2013-09-18 Thread MacQueen, Don
On possible way, if I understand the question correctly, is to use the findInterval() function. Otherwise, solutions depend on details you haven't included. Here's an example from ?findInterval x <- 2:18 v <- c(5, 10, 15) # create two bins [5,10) and [10,15) cbind(x, findInterval(x, v)) T

Re: [R] If-then with Dates in Date Ranges

2013-09-18 Thread jim holtman
You need to tell us what the objects are. Are they vectors of some type of data? If so, what type, etc.. At least provide a subset of the data using 'dput' so we know what we are looking at. The 'if' statement will work fine is the objects are single valued; you will need a different syntax

[R] If-then with Dates in Date Ranges

2013-09-17 Thread Zd Gibbs
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 (Beg1Da