ncss-tech / soilDB

soilDB: Simplified Access to National Cooperative Soil Survey Databases
http://ncss-tech.github.io/soilDB/
GNU General Public License v3.0
83 stars 19 forks source link

replace plyr / reshape2 functionality with data.table equivalent #161

Closed dylanbeaudette closed 3 years ago

dylanbeaudette commented 3 years ago

Keeping track of changes / testing related to data.table replacement of plyr / reshape functionality. Each change should be checked and a new test added if there isn't sufficient coverage. Handy bash script:

grep 'join(' * | awk '{print "  - [ ] `"$1"`"}' | tr -d ':.R' | sort | uniq

plyr

join

ddply

ldply

reshape2

reshape2::dcastdata.table::dcast

Note that value argument becomes value.var.

meltdata.table::melt

Caveats

dylanbeaudette commented 3 years ago

Nice work on those last changes. Looks like all that is left is get_colors_from_pedon_db?

brownag commented 3 years ago

Thanks, yes that was all that was left, now done in https://github.com/ncss-tech/soilDB/commit/66499a7b25dca70425de4924712386c1328da2f8

The conversion from plyr https://github.com/ncss-tech/soilDB/commit/2ad40e702ed8180afe261c34c0c1075a610e638e was fine but I was unable to verify the correctness of result due to some other dangling, previously un-detected issues with (un)coded moisture state resulting in a 0-length results even with data in the DB.

Testing any MS Access stuff takes some finagling on my work machine because I am still stuck with only 32-bit MS Access drivers (boo)

I also took this opportunity to convert from the (deprecated) mix_and_clean_colors to the newer estimateColorMixture. So now the mixing should be done in LAB (woo) and I have verified that fetchPedonPC / get_colors_from_pedon_db are working as expected.