R/Date_as_cmc.R

Date_as_cmc <-
function (x,format.in)
  { if (missing(format.in)) format.in <- "%Y-%m-%d"
  	if (is.character(x)) d <- as.Date (x,format.in)
  	if (class(x) =="Date") d <- x
  	lt <- as.POSIXlt(as.Date(d, origin="1900-01-01"))
	cmc <- lt$year*12 + lt$mon + 1
	return(list (cmc=cmc,
	             selectday=lt$mday))
  }

Try the Biograph package in your browser

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

Biograph documentation built on May 1, 2019, 8:48 p.m.