Re: [R] Spatial join between two datasets using x and y co-ordinates

From: Peter Alspach <PAlspach_at_hortresearch.co.nz>
Date: Wed, 07 May 2008 10:29:31 +1200

Andrew

?merge

HTH ...... Peter Alspach  

> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Andrew McFadden
> Sent: Wednesday, 7 May 2008 9:23 a.m.
> To: r-help_at_r-project.org
> Subject: [R] Spatial join between two datasets using x and y
> co-ordinates
>
> Hi R users
>
> I am trying to create a spatial join between two datasets.
>
> The first data set is large and contains descriptive data
> including x and y co-ordinates.
>
> The second dataset is small and has been selected spatially.
> The only data contained within the second dataset is the x
> and y coordinates only i.e. no descriptive data.
>
> The aim of a join made between the two datasets is to select
> those points (and hence all the descriptive data) from
> dataset one that has the same x and y co-ordinates as dataset two.
>
> x1<-c(1824615,1823650,1821910)
> y1<-c(5980732,5983220,5990931)
> descript<-c("cat", "dog", "horse")
> dat1<-data.frame(x1,y1,descript)
>
> x2<-c(1824615,1823650)
> y2<-c(5980732,5983220)
> dat2<-data.frame(x2,y2)
>
> dat1
> dat2
>
> The aim of the join is to produce:
>
> x1 y1 descript
> 1 1824615 5980732 cat
> 2 1823650 5983220 dog
>
> And therefore limit the data in dataset 1 to that which has
> the same x and y co-ordinates as dataset 2.
>
> Any suggestions?
>
> Regards
>
> Andy
>
>
> Andrew McFadden MVS BVSc
> Incursion Investigator
> Investigation & Diagnostic Centres - Wallaceville Biosecurity
> New Zealand Ministry of Agriculture and Forestry
>
> Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address:
> Investigation and Diagnostic Centre- Wallaceville Box 40742
> Ward St Upper Hutt
>
>
>
>
>
> ##############################################################
> ##########
> This email message and any attachment(s) is intended solely for the
> addressee(s) named above. The information it contains is confidential
> and may be legally privileged. Unauthorised use of the
> message, or the
> information it contains, may be unlawful. If you have received this
> message by mistake please call the sender immediately on 64 4 8940100
> or notify us by return email and erase the original message and
> attachments. Thank you.
>
> The Ministry of Agriculture and Forestry accepts no responsibility for
> changes made to this email or to any attachments after
> transmission from
> the office.
> ##############################################################
> ##########
>
> [[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.
>

The contents of this e-mail are privileged and/or confidential to the named  recipient and are not to be used by any other person and/or organisation.  If you have received this e-mail in error, please notify the sender and delete  all material pertaining to this e-mail.



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 Tue 06 May 2008 - 22:43:00 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 Tue 06 May 2008 - 23:30:36 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