Re: [R] Conditional editing of rows in a data frame

2010-01-28 Thread Gabor Grothendieck
If DF is your data frame then: DF$xp.bg <- ave(DF$xp.norm, DF$gene, FUN = min) will create a new column such that the entry in each row has the minimum xp.norm of all rows with the same gene. ave does use split internally but I think it would be worth trying anyways since its only one short lin

Re: [R] Conditional editing of rows in a data frame

2010-01-28 Thread David Winsemius
On Jan 28, 2010, at 7:05 AM, Irene Gallego Romero wrote: Dear R users, I have a dataframe (main.table) with ~30,000 rows and 6 columns, of which here are a few rows: id chr window gene xp.normxp.top 129 1_32 1 32 TAS1R1 1.28882115 FALSE 130 1_32 1 3

[R] Conditional editing of rows in a data frame

2010-01-28 Thread Irene Gallego Romero
Dear R users, I have a dataframe (main.table) with ~30,000 rows and 6 columns, of which here are a few rows: id chr window gene xp.normxp.top 129 1_32 1 32 TAS1R1 1.28882115 FALSE 130 1_32 1 32 ZBTB48 1.28882115 FALSE 131 1_32 1 32