Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-20 Thread R. Michael Weylandt
The key is that "Reduce" function -- it takes in a list of elements and combines them iteratively, e.g., `+` is only defined for two elements (at a time) but we can do something like Reduce(`+`, list(1,2,3)) = Reduce(`+`, list(1+2,3)) = Reduce(`+`, list(3,3)) = 3 + 3 = 6 Michael On Tue, Mar 20

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-20 Thread Paul Miller
Hi Brian, This works very well. Still trying to develop some skill with R. So can't say I understand your function completely as yet, but will work on it. I had thought that your function might only work for two columns (because of the "function(x,y)" part), but the example below suggests it wi

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-19 Thread Brian Diggs
On 3/17/2012 6:24 AM, Paul Miller wrote: Hello All, Need to coalesce some columns using R. Looked online to see how this is done. One approach appears to be to use ifelse. Also uncovered a coalesce function in the BBmisc, emoa, and microbenchmark packages. Trouble is I can't seem to get it to w

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-17 Thread Paul Miller
Hi Michael, So the coalesce functions don't do what I thought they did. I'll just use ifelse() then unless anyone makes it clear I should do something different. Thanks, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-17 Thread R. Michael Weylandt
I don't think any of these are doing what you want -- they just scan a list of arguments for the first non-null argument (with some small differences in implementation). They're more programming utilities than data analysis tools. It sounds like it's going to be easier to whip something up with ife

[R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-17 Thread Paul Miller
Hello All, Need to coalesce some columns using R. Looked online to see how this is done. One approach appears to be to use ifelse. Also uncovered a coalesce function in the BBmisc, emoa, and microbenchmark packages. Trouble is I can't seem to get it to work in any of these packages. Or perhaps