Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phase out plyr / reshape2 in favor of data.table #32

Open
3 of 18 tasks
dylanbeaudette opened this issue Jan 21, 2021 · 0 comments
Open
3 of 18 tasks

phase out plyr / reshape2 in favor of data.table #32

dylanbeaudette opened this issue Jan 21, 2021 · 0 comments

Comments

@dylanbeaudette
Copy link
Member

dylanbeaudette commented Jan 21, 2021

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

  • sampleasterStackByMU

ddply

  • FFD
  • componentadjmatrix

ldply

  • PLSS2LL
  • sampleasterStackByMU
  • samplingStability

dlply

  • componentadjmatrix
  • site_photos_kmlkml_placemarks

reshape2

reshape2::dcastdata.table::dcast

  • componentadjmatrix
  • geomorphBySoilSeries-SSUGO
  • multinominal2logical
  • vizAnnualClimate

Note that value argument becomes value.var.

meltdata.table::melt

  • diagnosticPropertyPlot
  • vizFlatsPosition
  • vizGeomorphicComponent
  • vizHillslopePosition
  • vizMountainPosition
  • vizTerracePosition

Caveats

  • It appears that data.table::melt will not preserve factor type / levels unless asked to do so explicitly via value.factor argument. A reasonable solution is to set it after the reshape operation when appropriate.
  • id.vars should not contain duplicated column names
  • melt.data.table expects that all measure.vars are of the same type (e.g. all numeric) otherwise warning issued
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant