[R] How to convert Charagter variables into numeric

Karina Knaus Karina.Knaus at e-control.at
Fri Feb 6 13:05:14 CET 2009

You might want to try as.numeric(X), if you want to convert a factor then
you could use as.numeric(as.character(X)), where X is a "variable".


On Thu, 5 Feb 2009 22:50:38, <arup.pramanik27 at gmail.com> wrote:

> I am importing a dataset in R where some of the variable are numerical
> some of them are character...but the problem is that R is treating
> numerical variables as character (I am using "is.character" to judge the
> type). Now the question is how can I convert these character variables
> numeric and also let me know about the other conversion like "numeric to
> categorical","numeric to continuous" etc.Thank you.
> Arup

More information about the R-help mailing list