Skip to content

Commit

Permalink
Fix longcombo bug with nonsense comp requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
sashahafner committed Nov 24, 2018
1 parent 60af33d commit 406be94
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ biogas package
## DETAILED LOG ########################
########################################

24 Nov 2018 SDH
Version 1.11.1

cumBg.R
Fix need for comp with data.struct = longcombo even though it wasn't used. Fix
related error with use of vol instead of mass object in grav code.

21 and 22 June 2018 Sasha D. Hafner
Version 1.11.0

Expand Down
15 changes: 10 additions & 5 deletions R/cumBg.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Modified:

cumBg <- function(
# Main arguments
dat,
Expand Down Expand Up @@ -617,7 +615,12 @@ cumBg <- function(
# Check for pressure and temperature--required, but default is NULL (for use of volumetric method without standardization) so must check here
if(is.null(temp)) stop('temp argument missing but is required for gravimetric method.')
if(is.null(pres)) stop('pres argument missing but is required for gravimetric method.')
if(is.null(comp)) stop('comp argument missing but is required for gravimetric method.')
# With longcombo separate comp data frame is not needed, only comp.name is needed in main data frame
if(data.struct == 'longcombo') {
if(is.null(comp.name)) stop('comp.name argument missing but is required for gravimetric method.')
} else {
if(is.null(comp)) stop('comp argument missing but is required for gravimetric method.')
}

# In this section main data frame is saved to `dat`, and name of response (mass) to `mass.name`
mass <- dat
Expand Down Expand Up @@ -676,8 +679,10 @@ cumBg <- function(

# Sort and return results
mass <- mass[order(mass[, id.name], mass[, time.name]), ]
if(is.null(comp)) {
vol <- vol[, !names(vol) %in% c(comp.name, 'vCH4', 'cvCH4', 'rvCH4')]
# Drop comp-related columns if comp not provided
# With longcombo separate comp data frame is not needed, only comp.name is needed in main data frame
if((data.struct != 'longcombo' & is.null(comp)) | (data.struct == 'longcombo' & is.null(comp.name))) {
mass <- mass[, !names(mass) %in% c(comp.name, 'vCH4', 'cvCH4', 'rvCH4')]
}
rownames(mass) <- 1:nrow(mass)

Expand Down

0 comments on commit 406be94

Please sign in to comment.