Skip to content

Commit

Permalink
Merge pull request #103 from AQLT/master
Browse files Browse the repository at this point in the history
- easter.enabled bug with x13
- default dates of spec_spac for clarity
  • Loading branch information
AQLT committed Mar 11, 2022
2 parents b6ca1e9 + 8f3ae42 commit db00d21
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

- bug with x11 introduced in RJDemetra 0.1.9 (issue #99)

- `easter.enabled` not working since RJDemetra 0.1.9

# RJDemetra 0.1.9

- easter specification was not working.

- some typo in the documentation
- some typo in the documentation.

- SystemRequirement update: only Java JRE is needed
- SystemRequirement update: only Java JRE is needed.

# RJDemetra 0.1.8

Expand Down
3 changes: 2 additions & 1 deletion R/spec_rjd.R
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,11 @@ spec_regarima_X13_r2jd <- function(spec = NA, jdspec = NA){
jtd<-.jcall(jcalendar,"Ljdr/spec/x13/TradingDaysSpec;","getTradingDays")
jeaster<-.jcall(jcalendar,"Ljdr/spec/x13/EasterSpec;","getEaster")

.jcall(jeaster,"V","setEnabled",as.logical(easter[1]))

.jcall(jeaster,"V","setTest", as.character(easter[4]))
.jcall(jeaster,"V","setJulian",as.logical(easter[2]))
.jcall(jeaster,"V","setDuration", as.integer(easter[3]))
.jcall(jeaster,"V","setEnabled",as.logical(easter[1]))

#Calendar options:
if(td[1] == "UserDefined"){
Expand Down
32 changes: 16 additions & 16 deletions R/spec_transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- paste("From",as.character(x.from), sep=" ")
z.type <- "From"
z.d0 <- as.character(x.from)
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- 0
z.n1 <- 0
}else{
Expand All @@ -71,7 +71,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- paste("Last",as.character(x.last),"periods", sep=" ")
z.type <- "Last"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- 0
z.n1 <- x.last
if (sum(!is.na(x.first),!is.na(x.exclFirst),!is.na(x.exclLast))!=0) {
Expand All @@ -85,7 +85,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- paste("First",as.character(x.first),"periods", sep=" ")
z.type <- "First"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- x.first
z.n1 <- 0
if (sum(!is.na(x.exclFirst),!is.na(x.exclLast))!=0) {
Expand All @@ -101,13 +101,13 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- "All"
z.type <- "All"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- 0
z.n1 <- 0
}else{
z.type <- "Excluding"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- x.exclFirst
z.n1 <- x.exclLast

Expand All @@ -127,7 +127,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- "All"
z.type <- "All"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- 0
z.n1 <- 0

Expand All @@ -138,7 +138,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- paste("All but first",as.character(x.exclFirst),"periods", sep=" ")
z.type <- "Excluding"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- x.exclFirst
z.n1 <- 0

Expand All @@ -149,7 +149,7 @@ spec_span<-function(from=NA_character_,to=NA_character_,first=NA_integer_,last=N
z.span <- paste("All but last",as.character(x.exclLast),"periods", sep=" ")
z.type <- "Excluding"
z.d0 <- "1900-01-01"
z.d1 <- "2020-12-31"
z.d1 <- "2100-12-31"
z.n0 <- 0
z.n1 <- x.exclLast

Expand Down Expand Up @@ -499,18 +499,18 @@ spec_tdX13<-function(td, tf, tadj){

spec_easterX13<-function(easter){

easter[3,1] <- if(!is.na(easter[2,1])) {easter[2,1]} else {easter[1,1]}
easter[3,"enabled"] <- if(!is.na(easter[2,"enabled"])) {easter[2,"enabled"]} else {easter[1,"enabled"]}

if (easter[3,1]== FALSE) {
easter[3,2] <-FALSE
easter[3,3] <-easter[1,3]
if (easter[3,"enabled"]== FALSE) {
easter[3,2] <- FALSE
easter[3,3] <- easter[1,3]
easter[3,4] <- "None"
}
if (is.na(easter[3,2])){
easter[3,2] <- if (!is.na(easter[2,2])) {easter[2,2]} else {easter[1,2]}
if (is.na(easter[3,"julian"])){
easter[3,"julian"] <- if (!is.na(easter[2,"julian"])) {easter[2,"julian"]} else {easter[1,"julian"]}
}
if (is.na(easter[3,4])){
easter[3,4] <- if (!is.na(easter[2,4])) {easter[2,4]} else {easter[1,4]}
if (is.na(easter[3,"test"])){
easter[3,"test"] <- if (!is.na(easter[2,4])) {easter[2,4]} else {easter[1,"test"]}
}
if (is.na(easter[3,3])){
if (easter[3,4]=="Add") {
Expand Down

0 comments on commit db00d21

Please sign in to comment.