[R] paste name in for loop?

2009-11-30 Thread Douglas M. Hultstrand
Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout - c(1,5,10,25,50,100) for(i in xout) {

Re: [R] paste name in for loop?

2009-11-30 Thread Duncan Murdoch
On 30/11/2009 7:49 PM, Douglas M. Hultstrand wrote: Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout -

Re: [R] paste name in for loop?

2009-11-30 Thread Jorge Ivan Velez
Hi Douglas, You were almost there. Just remember that your iterator is i and not xout. R xout - c(1,5,10,25,50,100) R for(i in xout) print(paste(Areal_Ppt_, i,sqmi.txt, sep=)) [1] Areal_Ppt_1sqmi.txt [1] Areal_Ppt_5sqmi.txt [1] Areal_Ppt_10sqmi.txt [1] Areal_Ppt_25sqmi.txt [1]

Re: [R] paste name in for loop?

2009-11-30 Thread jim holtman
Here is what you want: xout - c(1,5,10,25,50,100) for(i in xout) { print(paste(Areal_Ppt_,i,sqmi.txt, sep=)) } Notice that 'i' will be assigned each value in xout; you do not have to index into the vector. Notice that you second value is 50 which is xout[5]. On Mon, Nov 30, 2009 at 7:49 PM,

[R] Paste in a FOR loop

2008-12-31 Thread Michael Pearmain
Hi All, I've been having a little trouble using R2HTML and a loop, but can't figure out where the problem lies, any hints gratefully received. My code at the minute, (Which does work) is in the following: library(R2HTML) HTMLStart(outdir =

Re: [R] Paste in a FOR loop

2008-12-31 Thread Stavros Macrakis
On Wed, Dec 31, 2008 at 6:12 AM, Michael Pearmain mpearm...@google.com wrote: summary(z.out.1) summary(s.out.1) hist(s.out.1$qi$ev)... This seemed a rather long winded way of doing things to me and a simple for loop should handle this, as later i want it to be dynamic for a number of groups