From 5ba2f131278ab8c7fca805d4746de946ea535475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Holl=C3=B3s?= Date: Tue, 15 Jan 2019 17:20:06 +0100 Subject: [PATCH] Fixing some namespace bugs and using ByteCompilation... --- RBBGCMuso/DESCRIPTION | 5 ++++- RBBGCMuso/NAMESPACE | 12 ++++++++++++ RBBGCMuso/R/parametersweep.R | 2 +- RBBGCMuso/R/quickeffect.R | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/RBBGCMuso/DESCRIPTION b/RBBGCMuso/DESCRIPTION index 9f93a32..f5a2d8b 100644 --- a/RBBGCMuso/DESCRIPTION +++ b/RBBGCMuso/DESCRIPTION @@ -21,7 +21,9 @@ Imports: ggplot2, rmarkdown, tibble, - tidyr + tidyr, + tcltk, + digest LinkingTo: Rcpp SystemRequirements: C++11 Maintainer: Roland Hollo's @@ -29,3 +31,4 @@ RoxygenNote: 6.1.0 Suggests: knitr, rmarkdown, VignetteBuilder: knitr +ByteCompile: true diff --git a/RBBGCMuso/NAMESPACE b/RBBGCMuso/NAMESPACE index 7d90249..86d844f 100644 --- a/RBBGCMuso/NAMESPACE +++ b/RBBGCMuso/NAMESPACE @@ -33,7 +33,9 @@ importFrom(dplyr,'%>%') importFrom(dplyr,filter) importFrom(dplyr,group_by) importFrom(dplyr,mutate) +importFrom(dplyr,select) importFrom(dplyr,summarize) +importFrom(dplyr,tbl_df) importFrom(ggplot2,aes) importFrom(ggplot2,aes_string) importFrom(ggplot2,element_blank) @@ -51,8 +53,18 @@ importFrom(ggplot2,theme) importFrom(ggplot2,xlab) importFrom(ggplot2,ylab) importFrom(limSolve,xsample) +importFrom(magrittr,'%<>%') importFrom(rmarkdown,render) importFrom(scales,percent) +importFrom(tcltk,tcl) +importFrom(tcltk,tclRequire) +importFrom(tcltk,tclVar) +importFrom(tcltk,tclvalue) +importFrom(tcltk,tk_choose.dir) +importFrom(tcltk,tk_choose.files) +importFrom(tcltk,tktitle) +importFrom(tcltk,tktoplevel) +importFrom(tcltk,tkwidget) importFrom(tibble,rownames_to_column) importFrom(tidyr,separate) useDynLib(RBBGCMuso) diff --git a/RBBGCMuso/R/parametersweep.R b/RBBGCMuso/R/parametersweep.R index a78a931..4cee78a 100644 --- a/RBBGCMuso/R/parametersweep.R +++ b/RBBGCMuso/R/parametersweep.R @@ -39,7 +39,7 @@ paramSweep <- function(inputDir="./", if(is.null(parameters)){ - parameters <- tk_choose.files(caption = "Please select a file with the parameters and the ranges") + parameters <- tcltk::tk_choose.files(caption = "Please select a file with the parameters and the ranges") } rmdFile <- "---\ntitle: \"ParameterSweep basic\"\n---\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n```{r, echo=FALSE}\nsuppressWarnings(library(RBBGCMuso))\n```\n```{r, echo=FALSE}\nparameters <- read.csv(\"parameters.csv\")\n```\n```{r,fig.width=10, fig.height=3, echo=FALSE}\nnumPar\nfor(i in 1:numPar){\n suppressWarnings(musoQuickEffect(calibrationPar=parameters[i,2],startVal = parameters[i,3], endVal = parameters[i,4],\nnSteps = 9,\noutVar = \"daily_gpp\",\nparName = parameters[i,1]))\n}\n```" diff --git a/RBBGCMuso/R/quickeffect.R b/RBBGCMuso/R/quickeffect.R index 51fa7b8..f6f2981 100644 --- a/RBBGCMuso/R/quickeffect.R +++ b/RBBGCMuso/R/quickeffect.R @@ -8,6 +8,11 @@ #' @param nSteps How many steps 'till you reach the endVal #' @param fileTochange Please choose "epc" "ini" or "both". This is the place of the orininal variable. #' @return An effect plot +#' @importFrom ggplot2 ggplot aes_string geom_line geom_point aes labs theme ggsave element_blank facet_wrap +#' @importFrom dplyr filter group_by summarize mutate '%>%' tbl_df select +#' @importFrom tibble rownames_to_column +#' @importFrom magrittr '%<>%' +#' @importFrom tidyr separate #' @export musoQuickEffect <- function(settings = NULL,calibrationPar = NULL, startVal, endVal, nSteps = 1, fileToChange="epc", outVar, parName = "parVal"){