[R] Latex: Date Format conversion

Marc Schwartz marc_schwartz at me.com
Thu Jun 10 19:25:47 CEST 2010


On Jun 10, 2010, at 12:19 PM, Marc Schwartz wrote:

> Felipe,
> 
> I would not do the processing in TeX, but do it in R and then pass the results to the \Sexpr{}'s.
> 
> If I am correctly understanding the process flow, put the following R code chunk before the point where you need to output the formatted dates:
> 
> <<results=hide>>
> 
>  START <- format(as.Date(report[1, 1], "%m/%d/%y"), "%B %d, %Y")
>  END <- format(as.Date(report[1, 15], "%m/%d/%y"), "%B %d, %Y")
> 
> @
> 
> 
> Then have the following in the document body:
> 
> Report from \Sexpr{START} & - & \Sexpr{END]} 


Quick correction, just noted a typo with the ']' in the second \Sexpr{}. That should be:

  Report from \Sexpr{START} & - & \Sexpr{END} 

Marc



More information about the R-help mailing list