Re: [R] help wrapping findInterval into a function

2011-12-08 Thread Steve E.
Michael (and others) - Right, 'within' did work, I had placed it in the wrong location previously, which your example code made clear. I wrapped several of these functions within a function to address all the desired flags in a single pass (probably horribly inefficient but it works). Thanks agai

Re: [R] help wrapping findInterval into a function

2011-12-07 Thread R. Michael Weylandt
So I don't know what you are trying to do with your function (and I might have incidentally messed it up), but within certainly does add the desired column: WaterData <- structure(list(Site = structure(c(3L, 3L, 3L, 3L, 3L, 3L), .Label = c("BV", "CB", "KP", "LA", "MR", "PIE"), class = "factor"), T

Re: [R] help wrapping findInterval into a function

2011-12-07 Thread Steve E.
forgot to attach the data set http://r.789695.n4.nabble.com/file/n4170695/WaterData.txt WaterData.txt -- View this message in context: http://r.789695.n4.nabble.com/help-wrapping-findInterval-into-a-function-tp4165464p4170695.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] help wrapping findInterval into a function

2011-12-07 Thread Steve E.
Thanks to everyone for continued assistance with this problem. I realize that I had not included enough information, hopefully I have done so here. I attached a dput output of a sample of the data titled 'WaterData' (and str output below). Below are dput outputs of the function I am trying to ge

Re: [R] help wrapping findInterval into a function

2011-12-07 Thread R. Michael Weylandt
Can't this be fixed by switching with to within? E.g., x = data.frame(a = 1:3, b = 4:6) AddRowSums <- function(df) within(df, d <- a + b) x <- AddRowSums(x) print(x) Michael On Wed, Dec 7, 2011 at 12:07 AM, David Winsemius wrote: > > On Dec 6, 2011, at 5:53 PM, Steve E. wrote: > >> Bill (and

Re: [R] help wrapping findInterval into a function

2011-12-06 Thread David Winsemius
On Dec 6, 2011, at 5:53 PM, Steve E. wrote: Bill (and David), Thank you very much for taking the time to respond to my query. You were right, I was creating and calling the function exactly as you had predicted. I revised the structure based on your suggestion. It runs but the output is

Re: [R] help wrapping findInterval into a function

2011-12-06 Thread Steve E.
Bill (and David), Thank you very much for taking the time to respond to my query. You were right, I was creating and calling the function exactly as you had predicted. I revised the structure based on your suggestion. It runs but the output is an array of the flags that are not attached to the

Re: [R] help wrapping findInterval into a function

2011-12-06 Thread William Dunlap
ject.org] On > Behalf Of David Winsemius > Sent: Tuesday, December 06, 2011 12:05 PM > To: Steve E. > Cc: r-help@r-project.org > Subject: Re: [R] help wrapping findInterval into a function > > > On Dec 6, 2011, at 11:43 AM, Steve E. wrote: > > > Dear R Community,

Re: [R] help wrapping findInterval into a function

2011-12-06 Thread David Winsemius
On Dec 6, 2011, at 11:43 AM, Steve E. wrote: Dear R Community, I hope you might be able to assist with a small problem creating a function. I am working with water-quality data sets that contain the concentration of many different elements in water samples. I need to assign quality- cont

[R] help wrapping findInterval into a function

2011-12-06 Thread Steve E.
Dear R Community, I hope you might be able to assist with a small problem creating a function. I am working with water-quality data sets that contain the concentration of many different elements in water samples. I need to assign quality-control flags to values that fall into various concentrati