3
$\begingroup$

Check this out enter image description here

I want to split the Dataset for graphical reasons, like creating a nice composition on a page, TakeList should do that.

$\endgroup$
  • $\begingroup$ Under "Properties and relations" in the documentation for TakeList it says how to implement TakeList in terms of TakeDrop, perhaps at least a serviceable workaround. $\endgroup$ – C. E. Dec 4 '18 at 20:56
2
$\begingroup$
With[{partition = TakeList[Range@Length@#, #2], d = #}, d /@ partition] &[dataset, {2, 4}]

enter image description here

Also:

Dataset /@ TakeList[Normal@dataset, {2, 4}]

same result

or, a cleaner alternative suggested by C.E. in comments,

FoldPairList[TakeDrop, dataset, {2, 4}]

same result

$\endgroup$
  • $\begingroup$ Dataset /@ TakeList[Normal@dataset, {2, 4}] should be by default I think $\endgroup$ – Fortsaint Dec 5 '18 at 1:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.