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 0.32815
What I want to do is to replace the Sample.Id with a corresponding number.The
number i have in another file,called Prot.amount
> Prot.amount[1:3,1]
10a 11a_1109 11b_1109
15.516 38.248 42.297
> row.names(NAD)<-(NAD[,1])
> NAD$Sample.Id <- replace(NAD$Sample.Id,
> NAD$Sample.Id=="10a",Prot.amount["10a",1])
> NAD[1:3,1:3]
Sample.Id Main.abs..1 Main.abs..2
10a 15.516 0.04836 0.04994
11a_1109 11a_1109 0.32245 0.36541
11b_1109 11b_1109 0.29293 0.32815
So what I have tried to do is to write a function that would allow me to
replace the values automatically of all dataframes. This I just can't get to
work.
Thank you so much in advance!
_________________________________________________________________
[[elided Hotmail spam]]
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.