Re: [R] How to change the class of data?

From: Christoph Heibl <christoph.heibl_at_gmx.net>
Date: Thu, 12 Jun 2008 08:52:34 +0200

Try:

x <- factor(1:10)
class(x)
x + 1
class(x) <- "numeric"
x+1

On Jun 12, 2008, at 8:24 AM, Qman Fin wrote:

> Hi all,
>
> I have some data x, which are actualy consisted of numerical
> enties. But the
> class of this matrix is set to be "factor" by someone else. I used
> "class(x)", it turns out to be "factor". So I can not calculate them.
>
> How can I turn them into numerical data so that I can apply math
> operations
> on them? Thanks a lot for your help.
>
> Selina
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 12 Jun 2008 - 08:44:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 09:30:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive