I am using the jsonlite package to work with a complex json file in r. To give a sense of its complexity, here is a look into two different data frames it contains
> output$dataobjects[1]$dataobject$scoredresults$x
        xid rawscore tscore percentile standarderror omit
  1   LAC.1        0      0          0             0    0
  2   LAC.5        0      0          0             0    0
  3   LAC.9        0      0          0             0    0
  4  LAC.14        0      0          0             0    0
> output$dataobjects[1]$dataobject$scoredresults$y
       yid rawscore tscore percentile standarderror omit
1   c1.1.1        0      0          0             0    0
2   c1.1.3        0      0          0             0    0
3   c1.1.5        0      0          0             0    0
4   c1.1.6        0      0          0             0    0
I would like to dynamically edit this json based on an external dataframe. Say the dataframe looks like this
id <- c("LAC.1", "LAC.5", "c1.1.1", "c1.1.5", "LAC.14")
rawscore <- c(15, 10, 12, 14, 15)
type <- c("x", "x", "y", "y", "x")
df <- data.frame(id, rawscore, type)
I want to use a for-loop to iterate over the rows in this dataframe, updating the rawscore column in the json as I go. I can't figure out how to move from x to y within the json while staying within the for-loop. Please help!
