Skip to content
Prev 260803 / 398502 Next

Beginner Question: List value without Levels

Hi dabs,

Thanks for that.  Part of your problem is that the data in myVals is
not being stored as numbers, it is stored as factors.  If "," is your
decimal separator, then something like:

myVal2 <- unlist(myVal)
myVal2 <- as.numeric(levels(myVal2))[myVal2]

should convert it to numeric class data, at which point, all you need to do is:

myVal2 * data

and because R is vectorized, each element of "myVal2" will be
multiplied by each element of "data".  If "," is not a decimal
separator and indicates coordinates or something, then you will need
to handle it a little differently.

Cheers,

Josh
On Tue, May 24, 2011 at 12:31 PM, dabs <ragon016 at web.de> wrote: