From: Jingru Dai <jingru.dai_at_sci.monash.edu.au>

Date: Thu, 28 Feb 2008 14:44:52 +1100

School of Mathematical Sciences

Rm 454, Building 28

Monash University, 3800

Victoria, Australia

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 28 Feb 2008 - 03:48:27 GMT

Date: Thu, 28 Feb 2008 14:44:52 +1100

lon[i]<-112+0.05*(i-1)

}

for (i in 691:1){

x<-rep(0,length(xp)); y<-rep(0,length(yp)) for (i in 1:length(xp)){

x[i]<-(xp[i]-112)/0.05+1

}

for(j in 1:length(yp)){

y[j]<-(-10-yp[j])/0.05+1

}

So here the value of x and y should indicate the position where xp and
yp are in the vector lon and lat. And it appears to be the right
number. But when I tried to retrieve the value of lon using the
position, it returns the wrong value. Here's the result I got

* > x
*

[1] 1 2

> lon[x]

[1] 112 112

> lon[c(1,2)]

[1] 112.00 112.05

* > y
*

[1] 1 3

> lat[y]

[1] -10.00 -10.05

> lat[c(1,3)]

[1] -10.0 -10.1

I have no idea why it returns the wrong value when I subscripts by x,
while it works perfectly fine when I subscripts with the value of x
directly. Is there any special rule of subscripts? My version of R is
2.5.1.

Thanks a lot

Jingru Dai

School of Mathematical Sciences

Rm 454, Building 28

Monash University, 3800

Victoria, Australia

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 28 Feb 2008 - 03:48:27 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 28 Feb 2008 - 16:30:17 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.
*