Is there a simpler way to add a column to a Dataset than what I’m doing? I’ve defined a function to combine two (or more) separately created Datasets
joinDataset[x_List] := Transpose[Join @@ Transpose /@ x]
But all I want to do is to use data from a couple columns of the dataset and append the value to the dataset. The current process seems too laborious:
dataset = Dataset[{
<|"a" -> 1, "b" -> "x", "c" -> {1}|>,
<|"a" -> 2, "b" -> "y", "c" -> {2, 3}|>,
<|"a" -> 3, "b" -> "z", "c" -> {3}|>,
<|"a" -> 4, "b" -> "x", "c" -> {4, 5}|>}]
dataset = joinDataset[{dataset, dataset[All, <|"d" -> #a + #b|> &]}]
That will add a column “d” that adds “a” and “b” but I suspect there’s something built-in that will do this better.