Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion R/fcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
value.var = names(data)[ncol(data)]
lvals = value_vars(value.var, names(data))
valnames = unique(unlist(lvals))
if (any(valnames == "")) {

Check warning on line 139 in R/fcast.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/fcast.R,line=139,col=11,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.
valnames[valnames == ""] = ""

Check warning on line 140 in R/fcast.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/fcast.R,line=140,col=14,[nzchar_linter] Use !nzchar(x) instead of x == "". Note that unlike nzchar(), EQ coerces to character, so you'll have to use as.character() if x is a factor. Whenever missing data is possible, please take care to use nzchar(., keepNA = TRUE); nzchar(NA) is TRUE by default.

Check warning on line 140 in R/fcast.R

View check run for this annotation

Codecov / codecov/patch

R/fcast.R#L140

Added line #L140 was not covered by tests
}
if (any(duplicated(valnames))) {

Check warning on line 142 in R/fcast.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/fcast.R,line=142,col=7,[any_duplicated_linter] anyDuplicated(x, ...) > 0 is better than any(duplicated(x), ...).
valnames = make.unique(valnames, sep = sep)

Check warning on line 143 in R/fcast.R

View check run for this annotation

Codecov / codecov/patch

R/fcast.R#L143

Added line #L143 was not covered by tests
}
lvars = check_formula(formula, names(data), valnames, value.var.in.LHSdots, value.var.in.RHSdots)
lvars = lapply(lvars, function(x) if (length(x)) x else quote(`.`))
# tired of lapply and the way it handles environments!
Expand Down Expand Up @@ -252,4 +258,4 @@
setDT(ans); setattr(ans, 'sorted', lhsnames)
} else internal_error("empty rhsnames") # nocov
return(ans)
}
}

Check warning on line 261 in R/fcast.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/fcast.R,line=261,col=2,[trailing_blank_lines_linter] Add a terminal newline.
Loading