Skip to content
Prev 167718 / 398502 Next

matching more than two vectors (?)- Resolved

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.hannah at gmail.com>
To: Juliane Struve <juliane_struve at 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_struve at yahoo.co.uk> wrote: