Re: [R] replace elements of a data frame

2012-02-08 Thread Arnaud Gaboury
ne single line? Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Berend Hasselman [mailto:b...@xs4all.nl] Sent: mardi 7 février 2012 20:46 To: Arnaud Gaboury Cc: Jorge I Velez; r-help@r-project.org Subject: Re: [R] replace elements of a data frame On 07-02-2012, at 20:24, Arnaud Ga

Re: [R] replace elements of a data frame

2012-02-07 Thread Berend Hasselman
On 07-02-2012, at 20:24, Arnaud Gaboury wrote: > I did indeed have a look at recode(), and was able to replace, but an error > warning : > >> recode(names,"BO","BOO",df) > Warning message: > In recode.default(names, "BO", "BOO", df) : > Name(s) of vars duplicates with an object outside the dat

Re: [R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
I used in fact recode() from epilcac package, not the one you mentioned! Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Arnaud Gaboury Sent: mardi 7 février 2012 20:25 To: Jorge I Velez Cc: r-help@r-project.org; Arnaud Gaboury Subject: RE: [R] replace elements of a data frame I

Re: [R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
s prohibited and may be unlawful. If you have received this email in error please notify the sender. From: Jorge I Velez [mailto:jorgeivanve...@gmail.com] Sent: mardi 7 février 2012 19:55 To: Arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] replace elements of a data frame Hi Arnaud,

Re: [R] replace elements of a data frame

2012-02-07 Thread Jorge I Velez
Hi Arnaud, Take a look at require(car) ?recode HTH, Jorge.- On Tue, Feb 7, 2012 at 1:05 PM, Arnaud Gaboury <> wrote: > Hello, > > I am getting mad at finding a simple way to replace elements of a df. > > Here is a short df : > > > names<-c("BO","C","CL") > > price<-c("10","25","20") > > df<-d

[R] replace elements of a data frame

2012-02-07 Thread Arnaud Gaboury
Hello, I am getting mad at finding a simple way to replace elements of a df. Here is a short df : > names<-c("BO","C","CL") > price<-c("10","25","20") > df<-data.frame(names,price) I want to replace "BO" by "BOB", "C" by "CR", "CL" by "CLO", and the list is more long. I can do that for each