Dear Juliet,

I found out that the issue of matching more than two vectors can be avoided by 
pasting vectors into one using paste(). Also, it is not actually necessary for 
my problem to use match(). I was looking for a method to match points by 
coordinates, this can be done be using equal coordinates in an index. I 

this worked for me:

1. paste() puts both x and y coordinate into one column:

Examples: 

Dist_shoreDF$coord=paste(Dist_shoreDF$UTMX,Dist_shoreDF$UTMY,sep=",")
fishmove$coord[day=i+1]=paste(fishmove$UTMX[day=i+1],fishmove$UTMY[day=i+1],sep=",")

2. Equal coordinates can be used as an index to match two points:

Example:
fishlocationDF$distance[day=i+1]=Dist_shoreDF$distance[Dist_shoreDF$coord==fishmove$coord[day=i+1]]

reads the required distance from Dist_shoreDF into fishlocationDF for 
corresponding points. (This the bit that I was really looking for !).

Thank you for your time. 

Regards,

Juliane 




 Dr. Juliane Struve
Environmental Scientist
10, Lynwood Crescent
Sunningdale SL5 0BL
01344 620811 



----- Original Message ----
From: Juliet Hannah <juliet.han...@gmail.com>
To: Juliane Struve <juliane_str...@yahoo.co.uk>
Sent: Tuesday, 20 January, 2009 3:30:16
Subject: Re: [R] matching more than two vectors (?)

Could you create a small example of inputs and the desired output?


On Fri, Jan 16, 2009 at 3:57 PM, Juliane Struve
<juliane_str...@yahoo.co.uk> wrote:
> Dear listmembers,
>
> I am trying to obtain values for pointdistance from another dataframe by 
> matching UTMX and UTMY coordinates, but I am not sure how to introduce the 
> second coordinate.
>
> PointDF$pointdistance=DistanceDF$distance[match(PointDF$UTMX,DistanceDF$UTMX 
> & PointDF$UTMY,DistanceDF$UTMY )]
>
> is wrong but (hopefully) illustrates what I am trying to do.
>
> Could somebody help ?
>
> Thank you very much.
>
>
> Juliane
>
>
>
>
> ______________________________________________
> R-help@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.
>





______________________________________________
R-help@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.

Reply via email to