Skip to main content
8 events
when toggle format what by license comment
Jun 8, 2016 at 11:46 vote accept Edmund
Jun 7, 2016 at 17:15 comment added chuy This is probably the same thing in the end (but much wordier!) ds[MapAt[fold,#,{{"R1"},{"R2"}}]&@*Merge[Identity]][Transpose]
Jun 7, 2016 at 14:39 comment added WReach @Kuba The expression based upon @* does not work due to a limitation in the type inferencer. The result of the first mapping query operator has type Unknown. The second Transpose does not accept an unknown data type. As usual, the operators work just fine if we take the type system out of the picture, e.g. ds // Normal // Query[...]. In the alternate formulation in your response, the type deducer (not inferencer) gets a chance to restore the missing type information enabling the second Transpose to function. Oh, and +1.
Jun 7, 2016 at 13:49 comment added J. M.'s missing motivation @Edmund, as for your bonus: Prepend[ds, AssociationThread[{"Date", "R1", "R2"} -> {DateObject@{2007, 12, 31}, 100., 100.}]] works fine.
Jun 7, 2016 at 13:39 comment added Edmund It seems correct syntax. Odd that ds[Query[{"R1" -> fold, "R2" -> fold}]@*Transpose][Transpose] works and it doesn't. Does it have something to do with ascending and descending operators?
Jun 7, 2016 at 13:35 comment added Kuba @Edmund Do you possibly know why this is not working: ds[Transpose@*Query[{"R1" -> fold, "R2" -> fold}]@*Transpose]?
Jun 7, 2016 at 13:32 comment added Edmund This is reasonable. The dataset isn't so huge that the double Transpose will be a problem. +1 while we wait for other solutions.
Jun 7, 2016 at 13:26 history answered Kuba CC BY-SA 3.0