Re: [R] Replacing values in dataframes

2009-09-21 Thread Petr PIKAL
t has 30 rows, data has 23 > > > > meaning the dataframe NAD with the samples have 23 samples, the Prot.amounts > file have 30 different samples and their corresponding values. How do I > include into the loop that I only want to replace those Prot.amount values > found

Re: [R] Replacing values in dataframes

2009-09-21 Thread Monna Nygård
with the samples have 23 samples, the Prot.amounts file have 30 different samples and their corresponding values. How do I include into the loop that I only want to replace those Prot.amount values found in the NAD dataframe? Thank you so much! > Date: Sat, 19 Sep 2009 21:35:31 -0700 > To:

Re: [R] Replacing values in dataframes

2009-09-19 Thread Don MacQueen
What I would probably do is along these lines: iddf <- data.frame(Sample.id=names(Prot.amount), new.id=Prot.amount[1,]) newNAD <- merge( NAD, iddf) This is not tested, but it looks right to me, assuming I understand the structure of what you're trying to do. I'm also assuming that NAD h

Re: [R] Replacing values in dataframes

2009-09-19 Thread Schalk Heunis
I think this is what you want NAD$Sample.Id <- t(Prot.amount[NAD$Sample.Id]) HTH Schalk Heunis On Sat, Sep 19, 2009 at 12:18 PM, Monna Nygård wrote: > > Hi, > > > > This is a question of a newbie getting into the exciting world of R. > > > > I have several dataframes in the same format as NAD

[R] Replacing values in dataframes

2009-09-19 Thread Monna Nygård
Hi, This is a question of a newbie getting into the exciting world of R. I have several dataframes in the same format as NAD: > NAD[1:3,1:3] Sample.Id Main.abs..1 Main.abs..2 148 10a 0.04836 0.04994 167 11a_1109 0.32245 0.36541 173 11b_1109 0.29293