Skip to content

Commit 420a865

Browse files
Update for version 2.4.1
add jars version 2.4.1 add testthat
1 parent f46ef07 commit 420a865

7 files changed

Lines changed: 54 additions & 9 deletions

File tree

DESCRIPTION

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: rjd3highfreq
22
Type: Package
33
Title: Seasonal Adjustment of High Frequency Data with 'JDemetra+ 3.x'
4-
Version: 2.4.0.9500
4+
Version: 2.4.1
55
Authors@R: c(
66
person("Jean", "Palate", role = c("aut", "cre"),
77
email = "palatejean@gmail.com"),
@@ -16,17 +16,16 @@ Imports:
1616
rjd3toolkit (>= 3.7.1),
1717
rjd3xjars (>= 0.1.0),
1818
checkmate,
19+
forecast,
1920
methods
20-
Remotes:
21-
github::rjdverse/rjd3toolkit,
22-
github::rjdverse/rjd3xjars
2321
SystemRequirements: Java (>= 17)
2422
License: file LICENSE
2523
URL: https://github.com/rjdverse/rjd3highfreq, https://rjdverse.github.io/rjd3highfreq/
2624
LazyData: TRUE
2725
Suggests:
2826
knitr,
29-
rmarkdown
27+
rmarkdown,
28+
testthat
3029
RoxygenNote: 7.3.3
3130
BugReports: https://github.com/rjdverse/rjd3highfreq/issues
3231
Encoding: UTF-8

R/jd3_fractionalairline.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ fractionalAirlineDecomposition_ssf<-function(jdecomp) {
358358
jd2r_multiAirlineDecomposition <- function(jrslt, stde = FALSE, periods,
359359
log = FALSE, y_time = NULL) {
360360
ncmps <- rjd3toolkit::.proc_int(jrslt, "ucarima.size")
361-
model <- .arima_extract(jrslt, "ucarima_model")
361+
model <- .arima_extract(jrslt, "ucarima.model")
362362
cmps <- lapply(1:ncmps, function(cmp) {
363363
return(.ucm_extract(jrslt, cmp))
364364
})
@@ -424,7 +424,7 @@ jd2r_fractionalAirlineDecomposition <- function(jrslt,
424424
log = FALSE,
425425
y_time = NULL) {
426426
ncmps <- rjd3toolkit::.proc_int(jrslt, "ucarima.size")
427-
model <- .arima_extract(jrslt, "ucarima_model")
427+
model <- .arima_extract(jrslt, "ucarima.model")
428428
cmps <- lapply(
429429
X = 1:ncmps,
430430
FUN = function(cmp) .ucm_extract(jrslt, cmp)

R/zzz.R

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@
22
#' @import rjd3xjars
33

44
.onLoad <- function(libname, pkgname) {
5-
result <- .jpackage(pkgname, lib.loc = libname)
5+
if (!requireNamespace("rjd3xjars", quietly = TRUE)) stop("Loading rjd3 libraries failed")
6+
7+
result <- rJava::.jpackage(pkgname, lib.loc = libname)
68
if (!result)
79
stop("Loading java packages failed")
810

911
#proto.dir <- system.file("proto", package = pkgname)
1012
#RProtoBuf::readProtoFiles2(protoPath = proto.dir)
1113

14+
## Add all jar files in the "inst/java" directory to the classpath as
15+
## well. This is a kind of workaround for the source package and
16+
## bundle package version of the project where jar files are in
17+
## "inst/java" directory.
18+
##
19+
## The source and bundle package directory structure is used when two useful
20+
## functions: `devtools::load_all()` and `devtools::test()` are executed.
21+
## This workaround is not needed however when you run `devtools::check()` or
22+
## `R CMD check` from command line or when you use this package from a
23+
## third-party code when it is already installed in the system.
24+
## It is not needed in these cases because the binary package directory
25+
## structure is used.
26+
rJava::.jaddClassPath(dir(system.file("java", package=pkgname, lib.loc=libname), full.names = TRUE))
27+
28+
1229
# reload extractors
1330
try({
1431
.jcall(
9.79 KB
Binary file not shown.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<description>Usage: mvn -Pcopy-jars</description>
1212

1313
<properties>
14-
<jdplus-incubator.version>2.4.1-SNAPSHOT</jdplus-incubator.version>
14+
<jdplus-incubator.version>2.4.1</jdplus-incubator.version>
1515
</properties>
1616

1717
<dependencies>

tests/testthat.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
library(testthat)
2+
library(rjd3highfreq)
3+
4+
5+
test_check("rjd3highfreq")
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
library(rjd3highfreq)
2+
a <- as.numeric(forecast::taylor)
3+
mod <- fractionalAirlineDecomposition(
4+
y = a,
5+
period = 7,
6+
log = FALSE)
7+
8+
test_that("Decompose Model", {
9+
10+
expect_equal("ArimaModel", mod$ucarima$model$name)
11+
})
12+
13+
test_that("Decompose Model", {
14+
#number of components
15+
16+
expect_equal(3, length(mod$ucarima$components))
17+
})
18+
19+
reslt<-fractionalAirlineEstimation(a,c(7))
20+
21+
test_that("Estimate Model", {
22+
#ll
23+
expect_equal(-31687.65, reslt$likelihood$ll, tolerance=0.01)
24+
})

0 commit comments

Comments
 (0)