Hello, and I hope I can explain this a bit simply. I know that this can be done with a loop, but it will take a lot of time, and I need this analysis to be performed as part of the web page, so some function of the application should work much better, I hope.
I have 2 data frames. Data frame A has a list of individual βanchorsβ and category values ββfor each of them (these are weighted average values ββfrom ddply already executed).
anchor ecomax ecomin volume price runtime 1 9482 0.12981362 0.5714286 0.12981362 0.1324330 1.00000000 2 9488 0.01458662 0.5544864 0.01458662 0.2967270 0.04166667 3 9549 0.09734398 0.5721429 0.09734398 0.1219376 1.00000000 4 9574 0.00902656 0.5505136 0.00902656 0.1455307 0.14652568 5 9575 0.00902656 0.5505136 0.00902656 0.1460919 0.14652568 6 9576 0.07608863 0.5613563 0.07608863 0.1114813 1.00000000
Data frame B is a larger data frame with the same category values ββ(ignore the names for now), but there are several entries for each anchor.
anchor ecomax_max_med ecomin_min_med volume_med price_med run_time_minimum_med 1 9482 0.12981362 0.5714286 0.12981362 0.1120882 1.00000000 2 9482 0.12981362 0.5714286 0.12981362 0.1686777 1.00000000 3 9488 0.01552049 0.5550000 0.01552049 0.2925363 0.04166667 4 9488 0.01292292 0.5535714 0.01292292 0.3041928 0.04166667 5 9549 0.09734398 0.5721429 0.09734398 0.1238916 1.00000000 6 9549 0.09734398 0.5721429 0.09734398 0.1184564 1.00000000
I want to subtract category values ββfor B from their facilities (Data Frame A) based on its anchored anchor; those. the first 2 lines of B (anchor 9482) will differ from the first row of A (average value of anchor 9482), the next 2 lines of B (anchor 9488) will differ from the next row of A (value of anchor 9488), and so on.
The end result is that each row / column (except the binding) of the new Data Frame C is the difference between the values ββin Data Frame B and the corresponding associated tools (Data Frame A). Hope this is pretty straight forward; it can be easily done with a long cycle. I assume that this requires some combination of βmatchβ or βbyβ, but I'm not sure, and it was very unpleasant. Help!
source share