I want to create a table for the output of an sqlite command that I run repetitively in a for loop.
are the pictures of my code and the intended output.
I use PrettyTable when I code in Python. Is there a similar option in R?
Why not preallocate a dataframe and [over]write values with each iteration of the for loop?
before the loop:
output <- data.frame('region' = regions)
output$good_traffic <- 0
output$bad_traffic <- 0
within the loop:
output[output$region == region, 'good_traffic'] <- good_percent
output[output$region == region, 'bad_traffic'] <- bad_percent
after the loop:
print(output)