How can I swap columns of InMemoryDatasets?

I have the following example:

using InMemoryDatasets

g1 = repeat(1:6, inner = 4);
g2 = repeat(1:4, 6);
y = ["d8888b.  ", " .d8b.   ", "d888888b ", "  .d8b.  ", "88  `8D  ", "d8' `8b  ",
            "`~~88~~' ", " d8' `8b ", "88   88  ", "88ooo88  ", "   88    ", " 88ooo88 ",
            "88   88  ", "88~~~88  ", "   88    ", " 88~~~88 ", "88  .8D  ", "88   88  ",
            "   88    ", " 88   88 ", "Y8888D'  ", "YP   YP  ", "   YP    ", " YP   YP "];
ds = Dataset(g1 = g1, g2 = g2, y = y)

How can I swap the first and second column of ds?

Like

select!(ds, [:g2, :g1, :y])

?

Not sure if this is documented anywhere, but it works perfectly! :slight_smile:

use ?select for doc. What I found is that select in InMemoryDatasets in contrast to DataFrames only does “selecting” and using Not drops the column in the output.