Skip to content

Commit

Permalink
Merge pull request #22 from serbinsh/mApply_fix
Browse files Browse the repository at this point in the history
Quick patch to call correct mApply from Hmisc
  • Loading branch information
Shawn P. Serbin authored Dec 17, 2021
2 parents 9fd7c1d + 0386f7e commit 9caad94
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: FieldSpectra
Type: Package
Title: Functions for processing field spectroscopy data. Current supported instruments include ADS FieldSpec, Spectral Evolution, and Spectra Vista Corporation
Version: 0.9.6
Version: 0.9.7
Date: 2021-02-18
Author: Shawn P. Serbin
Authors@R:
Expand All @@ -10,6 +10,7 @@ Authors@R:
role = c("aut", "cre", "ctb"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-4136-8971")))
Maintainer: Shawn P. Serbin <[email protected]>
Description: A field spectroscopy package containing functions to process
spectral files collected using an Analytical Spectral Devices (ASD),
Spectral Evolution, or Spectra Vista Corporation (SVS) instruments. The goal
Expand All @@ -33,5 +34,4 @@ Copyright: Authors
LazyLoad: yes
LazyData: FALSE
Encoding: UTF-8
RoxygenNote: 7.1.1
VignetteBuilder: knitr
RoxygenNote: 7.1.2
Binary file removed FieldSpectra_0.9.6.pdf
Binary file not shown.
Binary file added FieldSpectra_0.9.7.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions R/average.spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ average.spec <- function(file.dir=NULL,out.dir=NULL,spec.type="Reflectance",star
stop("******** ERROR: Bias threshold too strict, no remaining spectra to average. Please correct ********")
}
### Get spectra averages
spec.avg <- mApply(mat.data,ind,colMeans,simplify=TRUE)
spec.avg <- Hmisc::Apply(mat.data,ind,colMeans,simplify=TRUE)
### Reformat data for further processing
if (is.null(dim(spec.avg)[1])) {
spec.avg <- data.frame(Spectra=unique(good.spec$Spectra), t(as.vector(spec.avg)))
Expand Down Expand Up @@ -343,7 +343,7 @@ average.spec <- function(file.dir=NULL,out.dir=NULL,spec.type="Reflectance",star
#ind <- factor(as.numeric(good.spec$Spectra))
ind <- factor(good.spec$Spectra)
mat.data <- as.matrix(good.spec[,2:dim(good.spec)[2]])
spec.avg <- mApply(mat.data,ind,colMeans,simplify=TRUE)
spec.avg <- Hmisc::mApply(mat.data,ind,colMeans,simplify=TRUE)
### Reformat spectral data for output
if (is.null(dim(spec.avg)[1])){
spec.avg <- data.frame(Spectra=unique(good.spec$Spectra), t(as.vector(spec.avg)))
Expand Down

0 comments on commit 9caad94

Please sign in to comment.