SimonGoring / neotoma_paper

Repository for the neotoma package paper.
MIT License
3 stars 2 forks source link

Use the analogue pkg for some of the data processing steps? #3

Closed gavinsimpson closed 10 years ago

gavinsimpson commented 10 years ago

In a couple of places you do some data manipulations which could be done more simply using tran() in the analogue package.

#  Get the percentage data for the first core:
core.pct <- as.data.frame(compiled.cores[[1]]$counts / rowSums(compiled.cores[[1]]$counts)) * 100

could be done as

#  Get the percentage data for the first core:
core.pct <- tran(compiled.cores[[1]]$counts, method = "percent")

Later in same code block

#  Eliminate taxa with no samples greater than 5%.
core.pct <- core.pct[, colSums(core.pct>5)>0]

could be done

core.pct <- chooseTaxa(core.pct, max.abun = 5)

Actually this is slightly different as this would retain species with 5% or greater.

Finally,

top.pinus <- function(x){
  #  Convert the core data into proportions by dividing counts by the sum of the row.
  x.pct <- x$counts / rowSums(x$counts)
  ....

could be

top.pinus <- function(x){
  #  Convert the core data into proportions by dividing counts by the sum of the row.
  x.pct <- tran(x$counts, method = "proportion")

This would require that analogue is loaded and might need me to push the version on Github to CRAN (but I don't think anything used here needs the new version) - which I'm happy to do in the next few days..

SimonGoring commented 10 years ago

I'm fine with that!

gavinsimpson commented 10 years ago

OK; let me just confirm whether any of this needs the devel version and analogue and if not I'll make those changes. If it does need the devel version then I'll release a new version to CRAN and then make the changes.

SimonGoring commented 10 years ago

Have you checked this out?

gavinsimpson commented 10 years ago

@SimonGoring Yes and it should be OK with 0.12-0 on CRAN. I'm just adding these locally to check with my current development version as I'm about to package that up for CRAN today. Will do a PR shortly if all is well with the changes I suggested above made.

gavinsimpson commented 10 years ago

I think we can close this one now following https://github.com/gavinsimpson/neotoma_paper/commit/e3d717858c5d2482eef3a97a8c142f11d68e49f7