Replace utils read with readr read function #442
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Was just having a quick look at
anc_spectrum_warning
andart_spectrum_warning
as we will use similar code to build the data for the new input plots. The majority of the time running these functions is just reading the spectrum files. Particularly for large countries. I've replaced the reading with utils::read.csv with readr as it is quite a bit faster.For DRC, read_dp is the function before this change, read_dp2 is the function after this change. Note the only difference should be is that where
read_dp
would return columns with the types set by R. They are always "character" now. I believe this is fine because we have to manually convert any data later anyway (see e.g.read_dp_art_dec31
) as the type interpretation is often broken due to how DP files are stored in disk.