Re: [R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread Joshua Wiley
On Mon, May 21, 2012 at 2:00 AM, peter dalgaard wrote: [snip] > What the poster probably wanted was something in the vein of > >> nm <- colnames(airquality)[1] >> ff <- formula(bquote(.(as.name(nm))~Month)) >> aggregate(ff, airquality, mean, na.rm=T) >  Month    Ozone > 1     5 23.61538 > 2     6

Re: [R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread peter dalgaard
On May 21, 2012, at 10:25 , Petr PIKAL wrote: > Hi > > You did not provide data but I can see some problems in your code. See > inline. >> >> I'm failing to get a for loop working. I'm sure it's something simple, > and I >> have found some posts relating to it, but I'm just not understanding

Re: [R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread Petr PIKAL
Hi You did not provide data but I can see some problems in your code. See inline. > > I'm failing to get a for loop working. I'm sure it's something simple, and I > have found some posts relating to it, but I'm just not understanding why > this isn't working. > > I have a data frame and woul

Re: [R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread Jeff Newmiller
No data, not reproducible. I think you should be using na.omit, though. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread Peter Keller
I'm failing to get a for loop working. I'm sure it's something simple, and I have found some posts relating to it, but I'm just not understanding why this isn't working. I have a data frame and would like to loop through specific column names, using aggregate() within a for loop. There are NA's

Re: [R] For Loop Error

2012-01-29 Thread Petr Savicky
On Sat, Jan 28, 2012 at 10:25:47AM -0800, Melrose2012 wrote: > Hi Again, > > I am writing a 'for loop' to create a matrix of randomly sampled colors. > I've written this loop in matlab and it works fine. I then tried to do it > in R and apparently there is something wrong with my syntax b/c ever

Re: [R] For Loop Error

2012-01-29 Thread Rui Barradas
Hello, > > Every time the loop blows up, I get back this error: > > Error in table.combos[i, ] <- table(combos) : > number of items to replace is not a multiple of replacement length > This is because not all colors are present in that one sample that breaks the code. > > There is no appar

[R] For Loop Error

2012-01-28 Thread Melrose2012
Hi Again, I am writing a 'for loop' to create a matrix of randomly sampled colors. I've written this loop in matlab and it works fine. I then tried to do it in R and apparently there is something wrong with my syntax b/c every time I run the script, the for loop "blows up" at a different point i