Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jason Rupert
25, 35, 45, 55, 18, 28, 38, 48, 58), Lot=c(1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 11, 21, 31, 41, 51), Location = c("HSV", "ATH", "HSV", "ATH", "FLO", "HSV", "ATH", "HSV", "ATH", "FLO", "HSV&qu

Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread baptiste auguie
On 23 Mar 2009, at 17:39, Jason Rupert wrote: I would like to replace a few varaibles within a data frame. For example, in the dataframe below (contrived) I would like to replace the current housesize value only if the Location is HSV. However, I would like to leave the other values int

Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jorge Ivan Velez
Dear Jason, Try this: index<- with(test_data2_df,Location %in% "HSV") test_data2_df$HouseSize<-ifelse(index,1000,test_data2_df$HouseSize) # I used 1000 as reference test_data2_df HTH, Jorge On Mon, Mar 23, 2009 at 1:39 PM, Jason Rupert wrote: > > I would like to replace a few varaibles withi

[R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jason Rupert
I would like to replace a few varaibles within a data frame. For example, in the dataframe below (contrived) I would like to replace the current housesize value only if the Location is HSV. However, I would like to leave the other values intact. I tried "ifelse", but I don't really need