r - Convert factor to integer -


this question has answer here:

i manipulating data frame using reshape package. when using melt function, factorizes value column, problem because subset of values integers want able perform operations on.

does know of way coerce factor integer? using as.character() convert correct character, cannot perform operation on it, , as.integer() or as.numeric() convert number system storing factor as, not helpful.

thank you!

jeff

you can combine 2 functions; coerce characters thence numerics:

> fac <- factor(c("1","2","1","2")) > as.numeric(as.character(fac)) [1] 1 2 1 2 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -