[R] Graph Titles

chuck.01 CharlieTheBrown77 at gmail.com
Sat Jan 28 21:12:20 CET 2012


Hard to help without a short example dataset (please read posting guide!)
posted with dput(). 
You likely want to "paste" together a title for your graph. 
see 
?paste


Rambler1 wrote
> 
> Another simple question that is driving me crazy:
> I have a for loop that loops through a matrix and pulls data from two
> different variables, computes differences and runs a regression then plots
> a formula I made:
> 
> for(i in 1:1){
> halo <- sex[i,]    
> holder <- get(halo)['2011::'][,6]
> halo2 <- sex[i,2]
> holder2 <- get(halo2)['2011::'][,6]
> ret1<- diff(holder)[-1]
> ret2<- diff(holder2)[-1]
> model<- lm(ret1 ~ ret2 - 1)
> hr <- as.numeric(model$coefficients[1])
> pairs <- ret1 - hr * ret2
> plot(pairs)
> }
> 
> The loop works fine and the appropriate number of graphs are printed. 
> 
> How would I go about putting a title at the top that would change for each
> graph? 
> That two variables are "halo" and "halo2" form the for loop. 
> 
> Ideally I want it to look like this:
> plot(pairs, main = halo " vs " halo2)
> 
> Thank you for your help.
> 


--
View this message in context: http://r.789695.n4.nabble.com/Graph-Titles-tp4335020p4336830.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list