[R] Strange results converting string to number

Rolf Turner r.turner at auckland.ac.nz
Mon Oct 15 21:50:05 CEST 2007


On 16/10/2007, at 8:30 AM, pintinho wrote:

>
> Hi,
>
> I am getting a strange result while converting a string vector into  
> numeric
> vector:
>
>> Datas[1]
> [1] 37315
>
>> as.numeric(Datas[1])
> [1] 2
>
> Can anyone help me??

It would seem that ``Datas'' is a ***factor*** and NOT a ``string  
vector''
(i.e. not a vector of mode character).  There is much (repetitive)  
discussion
on this list of how to convert a factor to a numeric vector.  See FAQ  
7.10.

		cheers,

			Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list