[R] Problem with data conversion

Christian Schulz ozric at web.de
Sun Dec 14 14:23:04 CET 2003


> The variables mma, and dma are actually numerical variables but in the
> dataframe, they are represented as "characters". I tried to change the
type
> of the variables (from character to numeric) using the edit function (and
> bringing up the data grid where then I made changes), but the changes were
> not saved. I tried
>
> mma1 <- as.numeric(mma)

i'm not sure understanding your problem correct, but is it possible that you
forget the data.frame ,suppose your data.frame is df

df$mma <- as.numeric (mma)  should work
df$mma[df$mma == 0 ]  <-  1   #"or any other value"

regards,christian




More information about the R-help mailing list