Skip to content

Commit

Permalink
Bug correction, code improved
Browse files Browse the repository at this point in the history
  • Loading branch information
AQLT committed Feb 7, 2018
1 parent 7618bf7 commit 1f44b68
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: JDCruncheR
Title: Interface entre le cruncher JDemetra+ et R
Version: 0.2.0
Date: septembre 2017
Version: 0.2.1
Date: février 2017
Authors@R: c(person("Hien", "Pham", email = "trong-hien.pham@insee.fr", role = c("aut")),
person("Alain", "Quartier-la-Tente", email = "alain.quartier-la-tente@insee.fr", role = c("aut", "cre")))
Authors: Hien Pham [aut],
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
JDCruncher 0.2.1
================
Correction d'un bug sur les fonctions `retain_indicators()` et `remove_indicator()`.

JDCruncher 0.2.0
================

Expand Down
8 changes: 4 additions & 4 deletions R/QR_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ remove_indicators.default <- function(x, ...){
remove_indicators.QR_matrix <- function(x, ...){
indicators <- c(...)
modalities_to_remove <- which(colnames(x$modalities) %in% indicators)
values_to_remove <- which(colnames(x$value) %in% indicators)
values_to_remove <- which(colnames(x$values) %in% indicators)
if(length(modalities_to_remove) > 0){
x$modalities <- x$modalities[, - modalities_to_remove]
}
if(length(modalities_to_remove) > 0){
x$values <- x$values[, - modalities_to_remove]
if(length(values_to_remove) > 0){
x$values <- x$values[, - values_to_remove]
}
return(x)
}
Expand All @@ -258,7 +258,7 @@ retain_indicators.default <- function(x, ...){
retain_indicators.QR_matrix <- function(x, ...){
indicators <- c(...)
modalities_to_retain <- which(colnames(x$modalities) %in% indicators)
values_to_retain <- which(colnames(x$value) %in% indicators)
values_to_retain <- which(colnames(x$values) %in% indicators)
if(length(modalities_to_retain) > 0){
x$modalities <- x$modalities[, modalities_to_retain]
}
Expand Down
11 changes: 0 additions & 11 deletions R/extractQR.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ extract_QR <- function(matrix_output_file, sep = ";", dec = ","){
if(!file.exists(matrix_output_file)|length(grep("\\.csv$",matrix_output_file))==0)
stop("Le fichier n'existe pas ou n'est pas un fichier csv")

#
# for (nom_fichier in c("demetra_m", "series_y")){
# table <- read.csv(file = paste0(data_dir,"/", nom_fichier, ".csv"),
# sep = ";", dec = ",", stringsAsFactors = FALSE)
#
# assign(nom_fichier, value = table)
# }
demetra_m <- read.csv(file = matrix_output_file,
sep = sep, dec = dec, stringsAsFactors = FALSE,
na.strings = c("NA","?"))
Expand All @@ -76,11 +69,7 @@ extract_QR <- function(matrix_output_file, sep = ";", dec = ","){
}

demetra_m$series <- gsub("(^ *)|(* $)","",gsub("(^.* \\* )|(\\[frozen\\])","",demetra_m[,1]))
# years <- substr(series_y[,1],1,4)
demetra_m$frequency <- extractFrequency(demetra_m)
# sapply(2:ncol(series_y),function(i){
# max(table(years[!is.na(series_y[,i])]))
# })

demetra_m <- cbind(demetra_m,
extractARIMA(demetra_m),
Expand Down

0 comments on commit 1f44b68

Please sign in to comment.