From 97aba0d265abdd15736367c8f9989b2131983fc4 Mon Sep 17 00:00:00 2001
From: Peder <pbac@dtu.dk>
Date: Fri, 10 Jul 2020 15:06:49 +0200
Subject: [PATCH] Ready for testing 1.0.0 on different OS

---
 .Rbuildignore              |  3 ++-
 DESCRIPTION                |  4 ++--
 R/bspline.R                | 10 ++++++++--
 R/onlineforecast-package.R |  7 +++++--
 R/setpar.R                 |  2 ++
 cran-comments.md           | 35 +++++++++++++++++++++++++++++++++++
 make.R                     | 16 +++++++++++-----
 7 files changed, 65 insertions(+), 12 deletions(-)
 create mode 100644 cran-comments.md

diff --git a/.Rbuildignore b/.Rbuildignore
index 7a419b7..0a12514 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -10,4 +10,5 @@
 ^vignettes/online-updating.Rmd
 ^tests
 ^misc-R$
-^.*\.Rhistory$
\ No newline at end of file
+^.*\.Rhistory$
+^cran-comments.md
\ No newline at end of file
diff --git a/DESCRIPTION b/DESCRIPTION
index f08a8da..ecbd4d0 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -7,8 +7,8 @@ License: GPL-3
 Encoding: UTF-8
 LazyData: true
 Authors@R: c(
-    person("Peder", "Bacher", email="pbac@dtu.dk", role = c("aut", "cre")),
-    person("Hjorleifur G", "Bergsteinsson", email="hgbe@dtu.dk", role = c("aut")))
+    person("Peder", "Bacher", email="pbac@dtu.dk", role = "cre"),
+    person("Hjorleifur G", "Bergsteinsson", email="hgbe@dtu.dk", role = "aut"))
 Depends: R (>= 3.0.0)
 Imports:
     Rcpp (>= 0.12.18),
diff --git a/R/bspline.R b/R/bspline.R
index 0fe03e3..12143d0 100644
--- a/R/bspline.R
+++ b/R/bspline.R
@@ -17,11 +17,13 @@
 #' 
 #' @param X data.frame (as part of data.list) with horizons as columns named \code{kxx} (i.e. one for each horizon)
 #' @param Boundary.knots The value is NA: then the boundaries are set to the range of each horizons (columns in X). See \code{?splines::bs}
-#' @param intercept Default value is TRUE: in an onlineforecast model there is no intercept per defauls (set by \code{one()}. See \code{?splines::bs}
+#' @param intercept Default value is TRUE: in an onlineforecast model there is no intercept per default (set by \code{one()}). It's default to FALSE in \code{?splines::bs}.
 #' @param df See \code{?splines::bs}
 #' @param knots See \code{?splines::bs}
 #' @param degree See \code{?splines::bs}
+#' @param bknots Is just a short for Boundary.knots and replace Boundary.knots (if Boundary.knots is not given)
 #' @return List of data frames with the computed base splines, each with columns for the same horizons as in X
+#' @rdname bs
 #' @examples
 #'
 #' # How to make a diurnal curve using splines
@@ -52,7 +54,11 @@
 #'
 #'
 #' @export
-bspline <- function(X, Boundary.knots = NA, intercept = TRUE, df = NULL, knots = NULL, degree = 3) {
+bspline <- function(X, Boundary.knots = NA, intercept = TRUE, df = NULL, knots = NULL, degree = 3, bknots = NA) {
+    # bknots is just a short for Boundary.knots and replace if Boundary.knots are not given.
+    if(is.na(Boundary.knots)){
+        Boundary.knots <- bknots
+    }
     # If a list, then call on each element
     if (class(X) == "list") {
         # Call again for each element
diff --git a/R/onlineforecast-package.R b/R/onlineforecast-package.R
index b869b8c..153cc02 100644
--- a/R/onlineforecast-package.R
+++ b/R/onlineforecast-package.R
@@ -1,7 +1,10 @@
-#' onlineforecast
+#' Functions for online forecasting
 #'
-#' This package provides functions to support forecast models which run in an online setting, like demand, solar and wind power forecasts updated regularly - often hourly up to 48 hours ahead. 
+#' This package provides functions to for setting up forecast models which run in an online setting, e.g. like demand, solar and wind power forecasts updated regularly - often hourly, and forecasts up to 48 hours ahead.
 #'
+#' See the website \url{onlineforecasting.org} for more information.
+#' 
+#' @title Functions for online forecasting
 #' @docType package
 #' @name onlineforecast
 #' @useDynLib onlineforecast
diff --git a/R/setpar.R b/R/setpar.R
index a3c1f45..49efbe4 100644
--- a/R/setpar.R
+++ b/R/setpar.R
@@ -53,6 +53,8 @@ setpar <- function(tmpl = "ts", mfrow = c(1,1), ...) {
         # prm <- as.list(match.call()[i]) p <- list() for(i in 1:length(prm)) { p$new <-
         # eval(prm[[i]]) nams(p)[i] <- nams(prm)[i] } par(p)
     }
+    # Only done to remove NOTE in "R CMD check", that R6 package is not used
+    if(FALSE){ R6::R6Class("temp", public = list(x=1)) }
     # Set par and return the original par options(warn = (-1)) options(warn = 1)
     invisible(p)
 }
diff --git a/cran-comments.md b/cran-comments.md
new file mode 100644
index 0000000..499d22b
--- /dev/null
+++ b/cran-comments.md
@@ -0,0 +1,35 @@
+## Test environments
+* local Fedora install, R 3.6.3
+
+## R CMD check results
+There were 1 WARNING and 1 NOTE.
+
+
+One WARNING:
+
+* checking installed package size ... NOTE
+  installed size is  6.3Mb
+  sub-directories of 1Mb or more:
+    doc    3.0Mb
+    libs   2.7Mb
+
+So it's a little big maybe, cut can't make it smaller (it's 3 vignettes in doc)
+
+
+One NOTE:
+
+* checking compiled code ... WARNING
+File ‘onlineforecast/libs/onlineforecast.so’:
+  Found ‘abort’, possibly from ‘abort’ (C)
+    Objects: ‘RcppExports.o’, ‘rls_update_cpp.o’
+  Found ‘printf’, possibly from ‘printf’ (C)
+    Objects: ‘RcppExports.o’, ‘rls_update_cpp.o’
+
+We think that this must be related to the compiler used. We used Rcpp to include
+two cpp function, and only:
+include <RcppArmadillo.h>
+include <Rcpp.h>
+
+and don't do anything but matrix calculations and returning the results. So we
+it must be some setting in the compiler creating this warning. Hopefully it's
+not there when compiled on cran.
diff --git a/make.R b/make.R
index 0f98702..f1902eb 100644
--- a/make.R
+++ b/make.R
@@ -9,8 +9,9 @@
 library(devtools)
 library(roxygen2)
 
-# pack <- as.package("../onlineforecast")
-# load_all(pack)
+## document()
+## pack <- as.package("../onlineforecast")
+## load_all(pack)
 
 # Update NAMESPACE, use this function to export all functions! (with @export, but S3methods (e.g. print.lm) will not get exported, so change it to export)
 ## docit <- function(){
@@ -43,8 +44,8 @@ library(roxygen2)
 #use_test("newtest")
 
 # # Run all tests
-document()
-test()
+#document()
+#test()
 
 # # Run the examples
 # run_examples()
@@ -63,7 +64,6 @@ test()
 document()
 build(".", vignettes=TRUE)
 
-
 # Install it
 install.packages("../onlineforecast_1.0.0.tar.gz")
 
@@ -77,3 +77,9 @@ library(onlineforecast)
 
 # # What is exported?
 # onlineforecast::
+
+
+# ----------------------------------------------------------------
+# On release
+
+# Test it on Windows with: https://win-builder.r-project.org/
-- 
GitLab