Writing to the log within a loop, results in the last value to be written 'N' times. I'm guessing this is because of the future evaluation, but I'm not sure how to get around it.
test_data <- data.frame(id = 1:5, data = LETTERS[1:5], stringsAsFactors = FALSE)
for (i in seq_len(nrow(test_data))) {
message('Writing to log: ', jsonlite::toJSON(test_data[i, ]))
server$log('test', jsonlite::toJSON(list(input = test_data[i, ])))
}
Writing to the log within a loop, results in the last value to be written 'N' times. I'm guessing this is because of the future evaluation, but I'm not sure how to get around it.
outputs:
complete example based on the minimal fiery example: