Given a dataset, is there a way to modify a value?


(*data = First@Import["dataset.xlsx"];*)
 data= {{"Supplier", "Material", "Geography", "Quantity"}, {"Acme", "A", 
  "United States", 676.}, {"Acme", "B", "Argentina", 520.}, {"Acme", 
  "C", "Russia", 186.}, {"Acme", "D", "France", 568.}, {"Acme", "E", 
  "United States", 201.}, {"Beta", "A", "Argentina", 483.}, {"Beta", 
  "D", "Russia", 289.}, {"Beta", "F", "France", 177.}, {"Beta", "G", 
  "United States", 169.}, {"Beta", "H", "Argentina", 842.}, {"Gamma", 
  "G", "Russia", 123.}, {"Gamma", "H", "France", 709.}, {"Gamma", "I",
   "United States", 579.}, {"Gamma", "J", "Argentina", 
  163.}, {"Gamma", "K", "Russia", 238.}, {"Delta", "A", "France", 
  405.}, {"Delta", "B", "United States", 411.}, {"Delta", "D", 
  "Argentina", 740.}, {"Delta", "H", "Russia", 322.}, {"Delta", "K", 
  "France", 321.}}

{fields, data} = {First[#], Rest[#]} &@data;
myDataset = 
    Association, (Rule[#[[1]], #[[2]]] & /@ Transpose[{fields, #}] & /@

Trying to update a value

myDataset[1, "Material"] = B

You'll get an error

Set::write: Tag Dataset in xxx [1,Material] is Protected.


1 Answer 1


This problem has already been discussed in this question. Taliesin Beynon said

As for when L-value assignment will be available, I'm hoping 10.0.1 or 10.0.2, which are in the next month or two.

  • 1
    $\begingroup$ @Silvia 's answer discussed in the question you mention is a good workaround to address the issue observed. $\endgroup$
    – Zviovich
    Jul 16, 2014 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.