R/get_cycle.R

Defines functions get_cycle

Documented in get_cycle

get_cycle <-
function(data, day, month, day.end, month.end) {
  cycle <- numeric(nrow(data))
  i <- 1
  j <- 1
  while(j < nrow(data)) {
    while(!(data$month[j] == month.end & data$day[j] == day.end)) {
      cycle[j] <- i
      j <- j + 1
    }
    cycle[j] <- i
    j <- j + 1
    i <- i + 1
  }
  return(cycle)
}

Try the phenModel package in your browser

Any scripts or data that you put into this service are public.

phenModel documentation built on Aug. 2, 2019, 5:05 p.m.