-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from deleip/usdaUpdate
Usda update
- Loading branch information
Showing
31 changed files
with
644 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
ValidationKey: '1200840' | ||
ValidationKey: '1422201' | ||
AutocreateReadme: yes | ||
AcceptedWarnings: | ||
- 'Warning: package ''.*'' was built under R version' | ||
- 'Warning: namespace ''.*'' is not available and has been replaced' | ||
AcceptedNotes: .* includes the non-default packages.* | ||
allowLinterWarnings: no | ||
enforceVersionUpdate: no | ||
skipCoverage: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' @title calcFactorCosts | ||
#' @description combines factor costs for crop and livestock production in mio. US$MER05 | ||
#' @param datasource only source available is "USDA" (calculates factor costs by applying factor cost share from USDA | ||
#' to VoP from FAO) | ||
#' @param otherLivst boolean: should FAO livestock categories that can't be matched to MAgPIE categories (i.e. beeswax, | ||
#' wool, silkworms, and honey) be reported as "livst_other"? | ||
#' @param subsectors boolean: should output be aggregated or reported by crop and livestock subsectors? | ||
#' @param unit output currency unit based on the toolConvertGDP function from the GDPuc library | ||
#' @return List of magpie objects with results on country level, weight on country level, unit and description. | ||
#' @author Debbora Leip | ||
#' @examples | ||
#' \dontrun{ | ||
#' calcOutput("FactorCosts") | ||
#' } | ||
#' @importFrom magclass setNames dimSums time_interpolate | ||
|
||
calcFactorCosts <- function(datasource = "USDA", otherLivst = FALSE, subsectors = FALSE, | ||
unit = "constant 2017 US$MER") { | ||
|
||
facCostsCrops <- calcOutput("FactorCostsCrops", datasource = datasource, unit = unit, aggregate = FALSE) | ||
facCostsLivst <- calcOutput("FactorCostsLivst", datasource = datasource, otherLivst = otherLivst, | ||
unit = unit, aggregate = FALSE) | ||
|
||
factorCosts <- mbind(facCostsCrops, facCostsLivst) | ||
|
||
if (isFALSE(subsectors)) { | ||
factorCosts <- dimSums(factorCosts, dim = 3) | ||
} | ||
|
||
units <- paste0("mio ", unit) | ||
|
||
return(list(x = factorCosts, | ||
weight = NULL, | ||
unit = units, | ||
description = "Factor costs for crop and livestock production")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.