If I have a long list of form
{{1,2,3,4},{5,6,7,8}, ... {97,98,99,100}}
how do I edit/convert it by adding the text as shown below
{{1,2,3,4} -> group1, {5,6,7,8} -> group1, ... {97,98,99,100} -> group3}
(I want to prepare data for machine learning.)
That is, how to add something (not an element) to the end of an existing sub-list. I've discovered how to read in large datasets suitably prepared in a text editor (using ReadList
), but I'm wondering how to do the editing within Mathematica.
Surely this sort of editing is possible but I cannot find how to do it in the Documentation. I'm probably mis-understanding something quite simple.
list -> label
or a list of just labels (strings)? $\endgroup$