Re: [R] Replacing matching values by related values

2011-09-19 Thread Petr PIKAL
Hi Works for me, how did you tested it? v - sample(letters[1:10], 17, replace=T) d-data.frame(letters[1:10], 1:10) d[match(v,d[,1]),2] [1] 8 2 6 1 7 10 4 10 10 9 10 8 1 8 6 7 8 Regards Petr Předmět Re: [R] Replacing matching values by related values Thanks Michael. I

Re: [R] Replacing matching values by related values

2011-09-18 Thread Janssen, K.J.M.
...@gmail.com] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep

Re: [R] Replacing matching values by related values

2011-09-18 Thread David Winsemius
michael.weyla...@gmail.com [mailto:michael.weyla...@gmail.com ] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm

Re: [R] Replacing matching values by related values

2011-09-18 Thread Janssen, K.J.M.
Thanks. Kristel -Oorspronkelijk bericht- Van: David Winsemius [mailto:dwinsem...@comcast.net] Verzonden: zo 18-9-2011 15:20 Aan: Janssen, K.J.M. CC: michael.weyla...@gmail.com; r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values On Sep 18, 2011, at 3

Re: [R] Replacing matching values by related values

2011-09-18 Thread Justin Haynes
- Van: R. Michael Weylandt michael.weyla...@gmail.com [mailto: michael.weyla...@gmail.com ] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match

[R] Replacing matching values by related values

2011-09-17 Thread Janssen, K.J.M.
I am trying to replace values of a vector (consisting of 15 values) by a value that is related to a matching value in a dataset (consisting of 17 rows). Here's an example The vector: v - c(f,a,e,d,m,o,e,f,i,n,e,i,b,a,o) The dataset's columns consist of the following values d[,1] -

Re: [R] Replacing matching values by related values

2011-09-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep 17, 2011, at 4:33 PM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: I am trying to replace values of a vector (consisting of 15 values) by a