[R] Data manipulation

Petr PIKAL petr.pikal at precheza.cz
Tue Oct 16 16:39:53 CEST 2007


"Klaus Friis Østergaard" <farremosen at gmail.com> napsal dne 16.10.2007 


> 2007/10/15, Petr PIKAL <petr.pikal at precheza.cz>:
> Hi
> Well, let us put it another way. Do you want for each unique combination
> of Hole and Feature to subtract a value from one data frame, let us call
> it nom from another data frame, let us call it raw? If yes I assume you 
> have exactly same number of unique combinations of Hole and Feature 
> in both datasets.
> In that case you can use such for cycle (although there can be other 
> solutions)
> for (i in 1:no.of.unique.levels ) {
> selection <- interaction(raw$hole, raw$feature) %in% 
> nom$feature)[1]
> raw[selection,"value"] <- raw[selection,"value"]-nom[i,"value"]
> }
> I had to move on with the project and did a ruby script out side that 
put the 
> right values in the rawdata.
> But I will surely return to look at this solution.
> I question in the non table the combinations of Feature and Hole are 
unique is
> it possible to calculate this on the fly in R? 

Yes. If your next question is how, you can look at ?duplicated.


> -- 
> Klaus F. Østergaard, <farremosen(at)gmail dot com> 

More information about the R-help mailing list