R/yearstodays.R

"yearstodays" <-
function (x, xmin=NULL) {
	x <- x
	xmin <- xmin
	if (!is.null(xmin)) {		# xmin is given
		x <- x * 365.25
		x <- x - min(x, na.rm=TRUE) + xmin
	} else {					# xmin is not given, we construct julian dates (compatibles with chron, dates,...)
		if(is.null(yearorig <- options("chron.origin")$year))
			yearorig <- 1970
		x <- (x - yearorig) * 365.25
	}
	x
}

Try the pastecs package in your browser

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

pastecs documentation built on May 29, 2024, 5:56 a.m.