Re: [R] ifthen() question

2010-03-05 Thread Matthew Dowle
This post breaks the posting guide in multiple ways. Please read it again (and then again) - in particular the first 3 paragraphs. You will help yourself by following it. The solution is right there in the help page for ?data.frame and other places including Introduction to R. I think its mo

Re: [R] ifthen() question -- whoops--ifelse()

2010-03-04 Thread AC Del Re
OK, I got it figured out. I was not keying into a length greater than 1, so: # I added this object and placed it into the iftelse statement: lid <- sum(match(id, st[i], nomatch = 0)) out$var.g[i]<-ifelse(lid ==1, meta$var.g[id==st[i]], aggs(g=g[id==st[i]],

[R] ifthen() question

2010-03-04 Thread AC Del Re
Hi All, I am using a specialized aggregation function to reduce a dataset with multiple rows per id down to 1 row per id. My function work perfect when there are >1 id but alters the 'var.g' in undesirable ways when this condition is not met, Therefore, I have been trying ifthen() statements to ke