Skip to content
Snippets Groups Projects
Commit f5562e62 authored by pbac's avatar pbac
Browse files

Works with 4.0.2 in docker, but not on winbuilder

parent 97aba0d2
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,6 @@ Suggests:
data.table,
plotly
VignetteBuilder: knitr
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
URL: http://onlineforecasting.org
BugReports: https://lab.compute.dtu.dk/packages/onlineforecast/-/issues
......@@ -67,7 +67,7 @@ data.list <- function(...) {
#' subset(D, c("2010-12-15 02:00","2010-12-15 04:00"))
#'
#' # Cannot request a variable not there
#' \donttest{subset(D, nms=c("x","Ta"))}
#' \donttest{#subset(D, nms=c("x","Ta"))}
#'
#' # Take specific horizons
#' subset(D, nms=c("I","Ta"), kseq = 1:2)
......@@ -410,7 +410,6 @@ check.data.list <- function(object){
#'
#' @examples
#'
#' \donttest{
#' Dbuilding == Dbuilding
#'
#' D <- Dbuilding
......@@ -421,8 +420,9 @@ check.data.list <- function(object){
#' names(D)[5] <- "I"
#' names(D)[6] <- "Ta"
#' Dbuilding == D
#' }
#'
#'
#' @export
"==.data.list" <- function(x, y) {
if(length(x) != length(y)){
......
......@@ -183,10 +183,10 @@ forecastmodel <- R6::R6Class("forecastmodel", public = list(
# Evaluate the expression (input$expr)
L <- input$evaluate(data)
# Must return a list
if(class(L)=="matrix"){ return(list(as.data.frame(L))) }
if(class(L)=="data.frame"){ return(list(L)) }
if(class(L)!="list"){ stop(pst("The value returned from evaluating: ",input$expr,", was not a matrix, data.frame or a list of them."))}
if(class(L[[1]])=="matrix"){ return(lapply(L, function(mat){ return(as.data.frame(mat)) })) }
if(class(L)[1]=="matrix"){ return(list(as.data.frame(L))) }
if(class(L)[1]=="data.frame"){ return(list(L)) }
if(class(L)[1]!="list"){ stop(pst("The value returned from evaluating: ",input$expr,", was not a matrix, data.frame or a list of them."))}
if(class(L[[1]])[1]=="matrix"){ return(lapply(L, function(mat){ return(as.data.frame(mat)) })) }
return(L)
})
# Put together in one data.list
......
......@@ -168,10 +168,10 @@
#' @examples
#'
#' # Check if the model is setup and can be used with a given data.list
#' \donttest{model$check(Dbuilding)}
#' \donttest{#model$check(Dbuilding)}
#' # Add the model output
#' model$output <- "heatload"
#' \donttest{model$check(Dbuilding)}
#' \donttest{#model$check(Dbuilding)}
#' # Add the horizons to fit for
#' model$kseq <- 1:4
#' # No errors, it's fine :)
......
......@@ -51,14 +51,13 @@
#' getse(x, 2)
#'
#' # Will give an error when indexed (with integer) if the element is not there
#' \donttest{
#' x <- strsplit(c("x.k1","y.k2","x2"), "\\.")
#' getse(x, 1)
#' getse(x, 2)
#'
#' \donttest{x <- strsplit(c("x.k1","y.k2","x2"), "\\.")
#' #getse(x, 1)
#' #getse(x, 2)
#' }
#' # Use regex pattern for returning elements matching in the specified layer
#' getse(L, "^te", depth=2, useregex=TRUE)
#' }
#'
#' @export
getse <- function(L, inm = NA, depth = 2, useregex = FALSE, fun = NA) {
......
......@@ -118,7 +118,7 @@ lg.logical <- function(x, lagseq) {
#' lg(X, "-h")
#'
#' # If not same length as columns in X, then it doesn't know how to lag
#' \donttest{lg(X, 1:2)}
#' \donttest{#lg(X, 1:2)}
#'
#' \dontshow{
#' if(!class(lg(data.frame(k1=1:10), 2)) == "data.frame"){stop("Trying to lag data.frame with 1 column, but return is not class data.frame")}
......
......@@ -62,13 +62,13 @@
#'
#' # Use plotly
#' \donttest{library(plotly)
#' L <- plot_ts(D, c("heatload","Ta"), kseq=c(1,24), usely=TRUE, xlab="Time",
#' ylabs=c("Heat (kW)","Temperature (C)"))
#' #L <- plot_ts(D, c("heatload","Ta"), kseq=c(1,24), usely=TRUE, xlab="Time",
#' # ylabs=c("Heat (kW)","Temperature (C)"))
#'
#' # From plotly the figures are returned and can be further manipulated
#' # e.g. put the legend in the top by
#' L[[length(L)]] <- L[[length(L)]] %>% layout(legend = list(x = 100, y = 0.98))
#' print(subplot(L, shareX=TRUE, nrows=length(L), titleY = TRUE))
#' #L[[length(L)]] <- L[[length(L)]] %>% layout(legend = list(x = 100, y = 0.98))
#' #print(subplot(L, shareX=TRUE, nrows=length(L), titleY = TRUE))
#' }
#'
#' @rdname plot_ts
......
......@@ -17,10 +17,10 @@
#' @examples
#'
#' \donttest{
#' D <- Dbuilding
#' plotly_ts(D, c("heatload","Ta"), kseq=c(1,24))
#' plotly_ts(D, c("heatload","Ta"), kseq=c(1,24))
#' plotly_ts(D, c("heatload","Ta$|Ta.obs$"), kseq=c(1,24))
#' #D <- Dbuilding
#' #plotly_ts(D, c("heatload","Ta"), kseq=c(1,24))
#' #plotly_ts(D, c("heatload","Ta"), kseq=c(1,24))
#' #plotly_ts(D, c("heatload","Ta$|Ta.obs$"), kseq=c(1,24))
#' }
#'
#' @export
......
#----------------------------------------------------------------
# These packages must be installed
install.packages("Rcpp")
install.packages("R6")
install.packages("splines")
install.packages("digest")
# cpp matrix library
install.packages("RcppArmadillo")
# For develop install
install.packages("devtools")
install.packages("roxygen2")
# For testing and building vignettes
install.packages("rmarkdown")
install.packages("R.rsp")
install.packages("data.table")
install.packages("plotly")
# For building vignettes
# install.packages("R.rsp")
# cpp matrix library
# install.packages("RcppArmadillo")
#----------------------------------------------------------------
# Go
library(devtools)
library(roxygen2)
# Load the package directly
## 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(){
## document()
## # Read
## nm <- "NAMESPACE"
## x <- scan(nm, what="character", sep="\n",blank.lines.skip=FALSE)
## # Manipulate x
## for(i in 1:length(x)){
## if(length(grep("^S3method", x[i])) > 0){
## x[i] <- gsub(",",".",gsub("S3method", "export", x[i]))
## }
## }
## #
## write(x, nm)
## }
## docit()
# ----------------------------------------------------------------
# Do also "R CMD check ../onlineforecast_1.0.0.tar.gz", it does give some other results!
#devtools::check()
# Misc
#
# Add new vignette
#usethis::use_vignette("setup-data")
# ----------------------------------------------------------------
# For running tests in folder "tests/testthat/"
# Running tests in folder "tests/testthat/"
#
# https://kbroman.org/pkg_primer/pages/tests.html
# http://r-pkgs.had.co.nz/tests.html
#
# Initialize first time the the testing framework
#use_testthat()
# Init new test
......@@ -54,10 +57,6 @@ library(roxygen2)
# load_all(as.package("../onlineforecast"))
# test_file("tests/testthat/test-rls-heat-load.R")
# Add new vignette
#usethis::use_vignette("setup-data")
#usethis::use_vignette("setup-and-use-model")
#usethis::use_vignette("forecast-evaluation")
# ----------------------------------------------------------------
# Build the package (remember to rebuild vignettes for release)
......@@ -70,16 +69,59 @@ install.packages("../onlineforecast_1.0.0.tar.gz")
library(onlineforecast)
# # ----------------------------------------------------------------
# # Load the current version directly from the folder
# docit()
# load_all(as.package("../../onlineforecast"), export_all=FALSE)
# ----------------------------------------------------------------
# Test before release
devtools::check()
# # What is exported?
# onlineforecast::
devtools::check_built("../onlineforecast_1.0.0.tar.gz")
# Does give different results than check() above
system("R CMD check ../onlineforecast_1.0.0.tar.gz")
# ----------------------------------------------------------------
# On release
# Test it on Windows with:
# https://win-builder.r-project.org/
# Test it on Windows with: https://win-builder.r-project.org/
# Run another version of R
# see https://hub.docker.com/u/rocker
# Open terminal and "sudo su" (needed for podman to access files)
# Run "podman run --rm -d -p 8787:8787 -e ROOT=TRUE -e PASSWORD=pw -v $(pwd):/home/rstudio rocker/rstudio"
# In browser go to "localhost:8787"
# login: rstudio and pw
# Open make.R
# Set working directory to this files directory
# Run installation of packages
# Make a cup of coffee
# Go to terminal and run:
# "sudo apt-get install xml2"
# "sudo apt-get install texlive"
# Other versions with
# "podman run --rm -p 8787:8787 -e PASSWORD=pw -v /home/pbac/g:/home/rstudio/g rocker/rstudio:3.6.1"
# ----------------------------------------------------------------
# OLD, not exporting everything anymore
#
# 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(){
## document()
## # Read
## nm <- "NAMESPACE"
## x <- scan(nm, what="character", sep="\n",blank.lines.skip=FALSE)
## # Manipulate x
## for(i in 1:length(x)){
## if(length(grep("^S3method", x[i])) > 0){
## x[i] <- gsub(",",".",gsub("S3method", "export", x[i]))
## }
## }
## #
## write(x, nm)
## }
## docit()
## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
## availability of the package we do not yet enforce this here. It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
## With R 3.1.0 or later, you can uncomment the following line to tell R to
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support. However, for wider
## availability of the package we do not yet enforce this here. It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment