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 data frame, not a new column in the data frame as was my intention. So, the new configuration I tried was like this (where DataFrame is not a real data frame but just the word "DataFrame"): WQFlags <- function(DataFrame) {DataFrame$CalciumFlag <- with(DataFrame, ifelse(variable == "CaD_ICP", (dataqualifier <- c("Y", 'Q', "", "A") [findInterval(DataFrame$value, c(-Inf, 0.027, 0.1, 100, Inf))]),"")) } I called it using: WaterQualityData <- WQFlags(WaterQualityData) Again, the output is simply an array of the flags, unattached to a data frame. Can you suggest a way to modify this to make it work as desired, or, in the worst case, can I attach the resulting array of flag values? Thank you again! -- View this message in context: http://r.789695.n4.nabble.com/help-wrapping-findInterval-into-a-function-tp4165464p4166826.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.