A Dataset
with 16 columns or less is shown in a nice way:
Association @@@
Table["col" <> ToString@j -> i j, {i, 10}, {j, 16}] // Dataset
A Dataset with more than 16 columns no.
set = Association @@@
Table["col" <> ToString@j -> i j, {i, 10}, {j, 17}] // Dataset
At this point one can guess a proper subset of these 17 columns is shown in a nice way. Indeed:
set[All, 1 ;; 2]
Wrong guess :) But it's "easy" to improve this appearance:
set[All, 1 ;; 2] // Normal // Dataset
Am'I missing something or there is maybe a super-secret option to control this behavior?
Dataset
typesetting shows by modifying the variableDataset`$ElisionThreshold
. However, that doesn't help here. The problem is that when going from 16 to 17 columns, the deduced type of the data goes fromTypeSystem`Struct
toTypeSystem`Assoc
, which has different typesetting rules (although it probably should be displayed as nicely, perhaps a minor bug?). $\endgroup$Dataset`GetType
, e.g.Dataset`GetType[set]
. $\endgroup$Dataset
has an undocumented second argument, where you can explicitly specify the type:Dataset[data, type]
. So here you could doDataset[data, TypeSystem`Vector[TypeSystem`Struct[{"col1",...,"col17"}, {TypeSystem`Atom[Integer],....},10]]
$\endgroup$set[All, {1 ;; 2}]
if we are lucky @Mr.Wizard will be along shortly to improve it ;) $\endgroup$