[R] Recoding using the memisc package

Dieter Menne dieter.menne at menne-biomed.de
Sun Feb 13 17:01:21 CET 2011



Shige Song wrote:
> 
> Dear All,
> 
> I am trying to recode a variable using the functions provided by
> "memisc" package. Actually I am following the examples on page 9-10 of
> the vignette:
> 
> --------------------------------------------------------------------------
> d.fig <- within(d.fig,{
> sev <- recode(sev,
>               1 -> 0.9,
>               2 -> 1.0,
>               3 -> 1.1,
> ... and more
> })
> --------------------------------------------------------------------------
> 
> I keep get error message saying "Error in 0.9 <- 1 : invalid (do_set)
> left-hand side to assignment." Any idea what is going on? Thanks.
> 

Please, make a shorter example and provide a data set.

This works for me;

library(memisc)
d.fig = data.frame(sev=c(1,2,3))
d.fig <- within(d.fig,{
  sev <- recode(sev,
            1 -> 0.9,
            2 -> 1.0)
  }) 



-- 
View this message in context: http://r.789695.n4.nabble.com/Recoding-using-the-memisc-package-tp3303700p3303742.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list