ceff-tech / ffc_api_client

An R client for the online Functional Flows Calculator API
https://ceff-tech.github.io/ffc_api_client
9 stars 3 forks source link

Suppress NA warnings when converting FFC data to data frame #8

Closed nickrsan closed 4 years ago

nickrsan commented 4 years ago

Currently getting a whole stream of warnings as we convert to a data frame. These are safe and I tried to provide parameters to acknowledge that I knew it was adding NAs, but it didn't get rid of warnings.

ryanpeek commented 4 years ago

One thing to consider is wrapping this function with suppressWarnings(). Not ideal but would help. I'm not sure how to turn these off within the function, and in looking at the function itself I actually don't see where data.table::rbindlist() is being called?

ryanpeek commented 4 years ago

and interestingly, when I timed these, running with suppressWarnings significantly improved the speed of the function return!

library(tictoc)
tic("Start")
results_df <- suppressWarnings(get_results_as_df(results_ff)) # fastest
# results_df <- suppressWarnings(ffcAPIClient::get_results_as_df(results_ff)) # fast
# results_df <- ffcAPIClient::get_results_as_df(results_ff) # slowest
toc("Finish")
ryanpeek commented 4 years ago

Looks like this issue may be fixed because of the replace_na bit

nickrsan commented 4 years ago

Hah, I think I'd double filed this issue - thanks for pointing out that this is ready to close!