[R] Changing integer class
jim holtman
jholtman at gmail.com
Sat Jul 7 13:01:11 CEST 2007
?mode
> x <- 1:10
> str(x)
int [1:10] 1 2 3 4 5 6 7 8 9 10
> class(x) <- 'numeric'
> str(x)
int [1:10] 1 2 3 4 5 6 7 8 9 10
> mode(x) <- 'numeric'
> str(x)
num [1:10] 1 2 3 4 5 6 7 8 9 10
On 7/7/07, Christophe Genolini <cgenolin at u-paris10.fr> wrote:
> Hi all
>
> I define a function with two methods, one for numeric or integer.
> Sometime, I need the numeric method to be applied on integer. So I try
> to change the class of the integer but it does not work... Does someone
> know why ?
>
> > x<-1:3
> > class(x)
> [1] "integer"
> > class(x)<- "numeric"
> > class(x)
> [1] "integer"
>
> Thanks
>
> Christophe
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list