[R] How to select the column header with \Sexpr{}

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jul 12 23:18:15 CEST 2010


On 12/07/2010 5:10 PM, Felipe Carrillo wrote:
> Hi:
> Since I work with a few different fish runs my column headers change everytime
> I start a new Year. I have been using \Sexpr{} for my row and columns and now 
> I am trying to use with my report column headers. \Sexpr{1,1} is row 1 column 1,
> what can I use for headers? I tried \Sexpr{0,1} but sweave didn't like 
> it..Thanks in advance
> for any hints
> 

\Sexpr takes an R expression, and inserts the first element of the 
result into your text.  Using just "0,1" (not including the quotes) is 
not a valid R expression.

You need to use paste() or some other function to construct the label 
you want to put in place, e.g. \Sexpr{paste(0,1,sep=",")} will give you 
"0,1".

Duncan Murdoch



More information about the R-help mailing list