Skip to content

Commit

Permalink
Fix checks (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstaab authored Jul 9, 2019
1 parent 5592d4e commit b3f74d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/feature.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ feature_class <- R6Class("feature", inherit = model_part,
},
add_parameter = function(parameter, required = TRUE, add_par = TRUE) {
expr <- NA
if (is.numeric(parameter) && length(parameter) == 1) {
if (length(parameter) == 1 && is.numeric(parameter)) {
expr <- parameter
} else if (is.character(parameter) && length(parameter) == 1) {
} else if (length(parameter) == 1 && is.character(parameter)) {
expr <- parameter
} else if (is.par(parameter)) {
idx <- as.character(length(private$parameter) + 1)
private$parameter[[idx]] <- parameter
expr <- parameter$get_expression()
} else if (is.null(parameter) || is.na(parameter)) {
} else if (is.null(parameter) || any(is.na(parameter))) {
if (required) stop("Missing value for required parameter")
return(NA)
} else stop("Unexpected type of parameter")
Expand Down
2 changes: 1 addition & 1 deletion R/model_build.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ add_to_model.feature <- function(feat, model, feat_name) {
# Check that the population in the feature exists
pop <- feat$get_population()
if (!is.null(pop)) {
if (pop != "all" && !all(pop %in% get_populations(model))) {
if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
stop("Invalid population in ", feat_name, call. = FALSE)
}
}
Expand Down

6 comments on commit b3f74d4

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/model_build.R:65:60: style: Only use double-quotes.

if (any(!pop %in% get_populations(model)) && pop[1] != 'all' ) {
                                                           ^~~~~

Please sign in to comment.