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
...@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
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
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
-
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
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] -
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
7 matches
Mail list logo