[R] Plotting a date variable after GAM

Jean V Adams
Tue, 13 Dec 2011 21:16:27 -0000

Shige Song wrote on 12/12/2011 07:49:39 PM:

> Dear All,
>
> I am fitting a simple GAM model using the "gam" function in the
"mgcv"
> package. The only independent variable is a continuous variable
> representing the time of the event (in year and month) coded so that
> "0" represents January 1960, "1" represents February
1960, etc. Now
> when I try to plot the results, my x-axis ranges from "-200" to
"200",
> what I want is to convert these number into something like
"1950-01"
> or "Jan. 1950". What is the best way to do this?
>
> Many thanks.
>
> Best,
> Shige


How about decimal years?  Would that suffice?

yourdates <- -200:200
dec.year <- 1960 + yourdates/12

Jean
	[[alternative HTML version deleted]]