Skip to content

Commit

Permalink
Merge pull request #30 from TanguyBarthelemy/develop
Browse files Browse the repository at this point in the history
Add new logos and badges
  • Loading branch information
TanguyBarthelemy authored Jul 12, 2024
2 parents 7b2373f + 6c42fca commit 975b579
Show file tree
Hide file tree
Showing 25 changed files with 633 additions and 32 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Version: 2.1.1
Authors@R: c(
person("Jean", "Palate", role = c("aut"),
email = "[email protected]"),
person("Alain", "Quartier-la-Tente", role = c("aut","cre"),
person("Alain", "Quartier-la-Tente", role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-7890-3857")),
person("Tanguy", "Barthelemy", role = c("ctb"),
person("Tanguy", "Barthelemy", role = c("ctb", "art"),
email ="[email protected]"),
person("Anna", "Smyk", role = c("ctb"),
email ="[email protected]")
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Changed

* `cross_validation()` function renamed to `cve()`, `cross_validation()` is now deprecated.
* New .jar files added (related to [v2.2.0](https://github.com/jdemetra/jdplus-incubator/releases/tag/v2.2.0))

### Added

Expand Down
4 changes: 2 additions & 2 deletions R/1_moving_average.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ NULL
#' @export
moving_average <- function(x, lags = -length(x), trailing_zero = FALSE, leading_zero = FALSE){
if (inherits(x, "moving_average"))
return (x)
return(x)
x <- as.numeric(x)
if (trailing_zero)
x <- rm_trailing_zero_or_na(x)
Expand Down Expand Up @@ -193,7 +193,7 @@ setMethod("[",
indices <- seq_along(coefs)[i]
coefs[-indices] <- 0
if (all(coefs == 0))
return (moving_average(0, lags = lower_bound(x) + indices - 1))
return(moving_average(0, lags = lower_bound(x) + indices - 1))

moving_average(coefs, lags = lower_bound(x),
leading_zero = TRUE, trailing_zero = TRUE)
Expand Down
8 changes: 4 additions & 4 deletions R/2_finite_filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ finite_filters.moving_average <- function(sfilter,
rfilters = NULL,
lfilters = NULL,
first_to_last = FALSE){
if (is.null(lfilters) & !is.null(rfilters)) {
if (is.null(lfilters) && !is.null(rfilters)) {
if (first_to_last) {
rfilters <- rev(rfilters)
}
lfilters <- rev(lapply(rfilters, rev.moving_average))
} else if (!is.null(lfilters) & is.null(rfilters)) {
} else if (!is.null(lfilters) && is.null(rfilters)) {
if (!first_to_last) {
lfilters <- rev(lfilters)
}
rfilters <- rev(lapply(lfilters, rev.moving_average))
} else if (is.null(lfilters) & is.null(rfilters)) {
} else if (is.null(lfilters) && is.null(rfilters)) {
rfilters <- lfilters <- list()

}
Expand Down Expand Up @@ -329,7 +329,7 @@ as.matrix.finite_filters <- function(x, sfilter = TRUE, rfilters = TRUE, lfilter
sfilter_s <- rfilters_s <- lfilters_s <-
index_s <- index_r <- index_l <- NULL
if (!any(sfilter, rfilters, lfilters))
return (NULL)
return(NULL)
if (sfilter) {
sfilter_s <- list(x@sfilter)
index_s <- length(x@rfilters)
Expand Down
6 changes: 3 additions & 3 deletions R/fst_filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fst.moving_average<-function(weights, lags, passband=pi/6, ...){
fst.finite_filters<-function(weights, lags, passband=pi/6,
sfilter = TRUE, rfilters = TRUE, lfilters = FALSE, ...){
if (!any(sfilter, rfilters, lfilters))
return (NULL)
return(NULL)

sfilter_s <- rfilters_s <- lfilters_s <-
index_s <- index_r <- index_l <- NULL
Expand Down Expand Up @@ -184,13 +184,13 @@ mse.default<-function(aweights, sweights, density=c("uniform", "rw"), passband =
spectral <- match.arg(density)
rslt<-.jcall("jdplus/filters/base/core/AdvancedFiltersToolkit", "[D", "mseDecomposition",
sweights, aweights, spectral, passband)
return (c(accuracy=rslt[1], smoothness=rslt[2], timeliness=rslt[3], residual=rslt[4]))
return(c(accuracy=rslt[1], smoothness=rslt[2], timeliness=rslt[3], residual=rslt[4]))
}
#' @export
mse.finite_filters<-function(aweights, sweights = aweights@sfilter, density=c("uniform", "rw"), passband = pi/6,
sfilter = TRUE, rfilters = TRUE, lfilters = FALSE, ...){
if (!any(sfilter, rfilters, lfilters))
return (NULL)
return(NULL)

sfilter_s <- rfilters_s <- lfilters_s <-
index_s <- index_r <- index_l <- NULL
Expand Down
2 changes: 1 addition & 1 deletion R/implicit_forecast.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ implicit_forecast.default <- function(x, coefs){
}
#' @export
implicit_forecast.matrix <- function(x, coefs){
result <- do.call(cbind, lapply(seq_len(ncol(x)), function (i) implicit_forecast(x[,i], coefs = coefs)))
result <- do.call(cbind, lapply(seq_len(ncol(x)), function(i) implicit_forecast(x[,i], coefs = coefs)))
colnames(result) <- colnames(x)
result
}
2 changes: 1 addition & 1 deletion R/kernels.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ get_kernel <- function(kernel = c("Henderson","Uniform", "Triangular",
jkernel <- .jcall("jdplus/toolkit/base/core/data/analysis/DiscreteKernel",
"Ljava/util/function/IntToDoubleFunction;",
tolower(kernel), h, sd_gauss)
} else{
} else {
jkernel <- .jcall("jdplus/toolkit/base/core/data/analysis/DiscreteKernel",
"Ljava/util/function/IntToDoubleFunction;",
tolower(kernel), h)
Expand Down
10 changes: 5 additions & 5 deletions R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ rm_leading_zero_or_na <- function(x){
}
if (is.null(remove_i)){
x
} else{
} else {
x[-remove_i]
}
}
Expand All @@ -254,7 +254,7 @@ rm_trailing_zero_or_na <- function(x){
}
if (is.null(remove_i)){
x
} else{
} else {
x[-remove_i]
}
}
Expand All @@ -269,7 +269,7 @@ rm_trailing_zero <- function(x){
}
if (is.null(remove_i)){
x
} else{
} else {
x[-remove_i]
}
}
Expand All @@ -288,10 +288,10 @@ remove_bound_NA <- function(x) {
j <- j + 1
}

if (is.null(remove_i_first) & is.null(remove_i_last)){
if (is.null(remove_i_first) && is.null(remove_i_last)){
# list(data = x, leading = 0,
# trailing = 0)
} else{
} else {
x <- x[- c(remove_i_first, remove_i_last)]
}

Expand Down
42 changes: 32 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@ output: github_document

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.align="center",
fig.width = 8L
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.align = "center",
fig.width = 8L
)
options(max.print = 1000L)
```

# rjd3filters
# `rjd3filters` <a href="https://rjdverse.github.io/rjd3filters/"><img src="man/figures/logo.png" align="right" height="150" style="float:right; height:150px;"/></a>

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/rjd3filters)](https://CRAN.R-project.org/package=rjd3filters)

[![R-CMD-check](https://github.com/rjdverse/rjd3filters/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/R-CMD-check.yaml)
[![lint](https://github.com/rjdverse/rjd3filters/actions/workflows/lint.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/lint.yaml)

[![GH Pages built](https://github.com/rjdverse/rjd3filters/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/pkgdown.yaml)
<!-- badges: end -->


rjd3filters is an R package on linear filters for real-time trend-cycle estimates.
It allows to create symmetric and asymmetric moving averages with:
Expand All @@ -34,20 +44,32 @@ rjd3filters relies on the [rJava](https://CRAN.R-project.org/package=rJava) pack

Running rjd3 packages requires **Java 17 or higher**. How to set up such a configuration in R is explained [here](https://jdemetra-new-documentation.netlify.app/#Rconfig)


### Latest release

To get the current stable version (from the latest release):

```{r, eval = FALSE}
- From GitHub:

```{r, echo = TRUE, eval = FALSE}
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3toolkit@*release")
remotes::install_github("rjdverse/rjd3filters@*release")
```

- From [r-universe](https://rjdverse.r-universe.dev/rjd3filters):

```{r, echo = TRUE, eval = FALSE}
install.packages("rjd3filters", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org"))
```


### Development version

To get the current development version from GitHub:

```{r, eval = FALSE}
```{r, echo = TRUE, eval = FALSE}
# install.packages("remotes")
# Install development version from GitHub
remotes::install_github("rjdverse/rjd3toolkit")
remotes::install_github("rjdverse/rjd3filters")
```

Expand Down
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# rjd3filters
# `rjd3filters` <a href="https://rjdverse.github.io/rjd3filters/"><img src="man/figures/logo.png" align="right" height="150" style="float:right; height:150px;"/></a>

<!-- badges: start -->

[![CRAN
status](https://www.r-pkg.org/badges/version/rjd3filters)](https://CRAN.R-project.org/package=rjd3filters)

[![R-CMD-check](https://github.com/rjdverse/rjd3filters/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/R-CMD-check.yaml)
[![lint](https://github.com/rjdverse/rjd3filters/actions/workflows/lint.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/lint.yaml)

[![GH Pages
built](https://github.com/rjdverse/rjd3filters/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rjdverse/rjd3filters/actions/workflows/pkgdown.yaml)
<!-- badges: end -->

rjd3filters is an R package on linear filters for real-time trend-cycle
estimates. It allows to create symmetric and asymmetric moving averages
Expand All @@ -28,20 +40,30 @@ Running rjd3 packages requires **Java 17 or higher**. How to set up such
a configuration in R is explained
[here](https://jdemetra-new-documentation.netlify.app/#Rconfig)

### Latest release

To get the current stable version (from the latest release):

- From GitHub:

``` r
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3toolkit@*release")
remotes::install_github("rjdverse/rjd3filters@*release")
```

- From [r-universe](https://rjdverse.r-universe.dev/rjd3filters):

``` r
install.packages("rjd3filters", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org"))
```

### Development version

To get the current development version from GitHub:

``` r
# install.packages("remotes")
# Install development version from GitHub
remotes::install_github("rjdverse/rjd3toolkit")
remotes::install_github("rjdverse/rjd3filters")
```

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 975b579

Please sign in to comment.