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

Felipe Carrillo mazatlanmexico at yahoo.com
Mon Jul 12 23:45:54 CEST 2010


Thanks for the quick reply Duncan.
I don't think I have explained myself well, I have a dataset named "report" and 
my column headers are run1,run2,run3,run4 and so on. 

I know how to access the data below those columns with \Sexpr{report[1,1]} & 
&\Sexpr{report[1,2]} and so on, but I can't access my column headers
with \Sexpr{} because I can't find the way to reference run1,run2,run3 and run4. 
Sorry if I am not explain myself really well.
 



----- Original Message ----
> From: Duncan Murdoch <murdoch.duncan at gmail.com>
> To: Felipe Carrillo <mazatlanmexico at yahoo.com>
> Cc: r-help at stat.math.ethz.ch
> Sent: Mon, July 12, 2010 2:18:15 PM
> Subject: Re: [R] How to select the column header with \Sexpr{}
> 
> 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