Sarah Goslee
2012-Jan-13 16:48 UTC
[R] Nabble? Was Re: function to replace values doesn't work on vectors
Interesting: The email I received through the R-help list didn't have all the information that was apparently there: On Fri, Jan 13, 2012 at 11:32 AM, Berend Hasselman <bhh at xs4all.nl> wrote:> > WoutH wrote >> >> I've got a numeric vector with values ranging from 1 to 5, I would like to >> catagorize these values like this: >> >> 1 becomes catagory 1 >> 3 becomes catagory 3 >> And everything else in catagory 2. The simple function I wrote beneath >> works for single numeric data, but for some reason I am unable to feed it >> vectors. Any help would be appreciated, as I'm fairly new to R. >> >> function.123 <- function(x) >> ? ? { >> ? ? ? x1 <- ifelse(x == 1 | x == 3, return(x) ,return(2)) >> ? ? ? return(x1) >> ? ? } >>This function? Not in the original email as I received it, although it showed up in Berend's reply. I hope that it was a momentary glitch; greater disagreement between Nabble and the email list will cause all sorts of fun. If the interface, whatever it is, starts stripping out code? I'll have to quit answering Nabble queries entirely. Sarah -- Sarah Goslee http://www.functionaldiversity.org
Duncan Murdoch
2012-Jan-14 19:41 UTC
[R] Nabble? Was Re: function to replace values doesn't work on vectors
On 12-01-13 11:48 AM, Sarah Goslee wrote: ...> I hope that it was a momentary glitch; greater disagreement between Nabble > and the email list will cause all sorts of fun. If the interface, > whatever it is, > starts stripping out code? I'll have to quit answering Nabble queries entirely.You know, that's a great suggestion. I'm now filtering out all messages with "nabble.com" in the Message-ID. Duncan Murdoch