[R] assign value between different type: Double vs Integer

Sarah Goslee sarah.goslee at gmail.com
Sat Apr 24 16:45:48 CEST 2010

On Sat, Apr 24, 2010 at 9:31 AM, Dong GUO <cguous at gmail.com> wrote:
> Dear list,
> just to put it in a simple way:
> i read.csv from csv file to create a gdata
> then, create array gdata34
> however, when making a loop for assigning gdata34[1,m]<-gdata[m,4],
> this is what happen

So you assigned (m == 4)

gdata34[1, 4] <- gdata[4, 4]

> gdata[1,4] 's real value is 10354, however, the gdata34[1,4] turns to be 883

But now you expect
 gdata[1,4] == gdata34[1,4]

If your loop description is correct,
gdata34[1,4] <- gdata[4, 4]
gdata34[1,1] <- gdata[1,4]

Something is wrong either in your description or
your check. I don't think it has anything to do with
storage mode.


> then i checked the type: gdata[1,4] is integer, while gdata34[1,4] is double.
> Can any one give me some help on it????
> Many thanks in advance.
> Best regards,
> Dong
Sarah Goslee

More information about the R-help mailing list