Applying StringSplit to a column in a Dataset separated by \n?

I am struggling to get the right syntax. I have a column (called choice) that contains a string which has \n separated entires.
I want to create a new Dataset that has the entries of that column split into a list. I can’t work out how to pass the necessary arguments to StringSplit. I thought it would be

applications[All, Key["choice"] /* <|"split" -> StringSplit[#, "\n"] &|>]

But that just returns a Dataset with the string unsplit.

Could someone enlighten me?

Cheers,
Andy

Well, I just took a stab at what your data might look like, and then I tried your code above. It worked. So, your data must be structured differently than what I assumed. It would be a lot easier if you provided more details. Specifically, what the structure of your data is and what you want the output to be. If it’s a long list of data, you can abbreviate it, but we need to see the exact schema (for both input and output).

One thing that you might want to be careful of is precedence. It didn’t seem to matter to my experiment, but for what it’s worth,

<|"split" -> StringSplit[#, "\n"] &|> // FullForm

gives

Association[Function[Rule["split", StringSplit[Slot[1], "\n"]]]]

It might be that you intended

<|"split" -> (StringSplit[#, "\n"] &)|>

The FullForm of which is

Association[Rule["split", Function[StringSplit[Slot[1], "\n"]]]]

Thanks for your help Eric. I am pleased to know that what I was trying is - basically - correct. I will now go and find out what I did wrong :slight_smile: