Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# These packages must be installed
# For building vignettes
# install.packages("R.rsp")
# cpp matrix library
# install.packages("RcppArmadillo")
library(devtools)
library(roxygen2)
# 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()
# ----------------------------------------------------------------
# For 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
#use_test("newtest")
# # Run all tests
# test()
# # Run the examples
# run_examples()
# # Run tests in a single file
# load_all(as.package("../onlineforecast"))
# test_file("tests/testthat/test-rls-heat-load.R")
# ----------------------------------------------------------------
# Build the package (remember to rebuild vignettes for release)
install.packages("../onlineforecast_1.0.0.tar.gz")
library(onlineforecast)
# # Add new vignette
#usethis::use_vignette("test")
# # ----------------------------------------------------------------
# # Load the current version directly from the folder
# docit()
# load_all(as.package("../../onlineforecast"), export_all=FALSE)
# # What is exported?
# onlineforecast::