2
$\begingroup$

I have a Dataset of states and I need to modify a variable: States = Dataset[{<|"StateId" -> {Bt, 1, 1.15, q}, "B" -> Bt, "RC" -> "n", "Es" -> "n", "NC" -> Null,"e" -> N123|>}]

As of now I'm able to modify an entrance, for example "e" with this code: States = States[All, If[#StateId == {Bt, 1, 1.15, 2}, <|#, "e" -> "New element"|>, #] &].

I was wondering if there is a way to take the previous element: N123 in my case, and adding 1 (or other simple operations) so that I get N123+1 in the entrance "e", without using a Query.

$\endgroup$

1 Answer 1

2
$\begingroup$

States = States[All, If[#StateId == {Bt, 1, 1.15, 2}, <|#, "e" -> #e+1|>, #]&] works.

$\endgroup$

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.