[R] Spatial join between two datasets using x and y co-ordinates
Peter Alspach
PAlspach at hortresearch.co.nz
Wed May 7 00:29:31 CEST 2008
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.
More information about the R-help
mailing list