[R] convert factor data to numeric
Rolf Turner
r.turner at auckland.ac.nz
Wed Jan 13 20:27:02 CET 2010
On 14/01/2010, at 6:00 AM, Nathalie Yauschew-Raguenes wrote:
> Hello,
>
> I find a way to convert data in factor type to numeric :
> data_numeric <- as.numeric(as.character(data_factor)).
> It's treaky but works.
Possibly even more ``treaky'' but more efficient is:
data_numeric <- as.numeric(levels(data_factor)[data_factor])
as has been pointed out quite a few times on this list.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list