Skip to content

Commit 642a676

Browse files
committed
Linting and re-documenting
1 parent 8b773d6 commit 642a676

9 files changed

+26
-18
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ exportMethods(formula)
3232
exportMethods(show)
3333
exportMethods(summary)
3434
exportMethods(update)
35+
import(dplyr)
3536
import(jtools)
3637
import(methods)
3738
import(rlang)

R/crosslag_utils.R

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#' @importFrom stats terms
22
#' @import stringr
3+
#' @import dplyr
34
#' @importFrom panelr are_varying
45
formula_parser <- function(formula, dv, data) {
56
# See how many parts the formula has
@@ -138,7 +139,7 @@ formula_parser <- function(formula, dv, data) {
138139
the_call <-
139140
match.call(dplyr::lag, call = parse(text = v_info$term[i]))
140141
v_info$lag[i] <- if (!is.null(the_call$n)) the_call$n else 1
141-
v_info$root[i] <- as.character(the_call$x)
142+
v_info$root[i] <- to_char(the_call$x)
142143
}
143144
}
144145

@@ -165,7 +166,7 @@ formula_parser <- function(formula, dv, data) {
165166
if (length(wint_labs) > 0) {
166167
for (wint in wint_labs) {
167168
endog <- str_detect(wint, "(?<=pre\\().*(?=\\))")
168-
while (stringr::str_detect(wint, "(?<=pre\\().*(?=\\))")) {
169+
while(stringr::str_detect(wint, "(?<=pre\\().*(?=\\))")) {
169170
wint <- str_replace(wint, "(.*)(pre\\()(.*)(\\))(.*)", "\\1\\3\\5")
170171
}
171172

@@ -185,7 +186,7 @@ formula_parser <- function(formula, dv, data) {
185186
v_info[my_row, "max_lag"] <- max(lags)
186187
}
187188
}
188-
while (stringr::str_detect(wint_labs, "(?<=pre\\().*(?=\\))")) {
189+
while (any(stringr::str_detect(wint_labs, "(?<=pre\\().*(?=\\))"))) {
189190
wint_labs <- str_replace(wint_labs, "(.*)(pre\\()(.*)(\\))(.*)",
190191
"\\1\\3\\5")
191192
}
@@ -215,7 +216,7 @@ formula_parser <- function(formula, dv, data) {
215216
v_info[my_row, "max_lag"] <- max(lags)
216217
}
217218
}
218-
while (stringr::str_detect(cint_labs, "(?<=pre\\().*(?=\\))")) {
219+
while (any(stringr::str_detect(cint_labs, "(?<=pre\\().*(?=\\))"))) {
219220
cint_labs <- str_replace(cint_labs, "(.*)(pre\\()(.*)(\\))(.*)",
220221
"\\1\\3\\5")
221222
}

R/dpm.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ dpm <- function(formula, data, error.inv = FALSE, const.inv = FALSE,
139139
stop_wrap("data argument must be a data frame.")
140140
}
141141

142-
id <- as_name(enexpr(id))
143-
wave <- as_name(enexpr(wave))
142+
id <- as_name(enquo(id))
143+
wave <- as_name(enquo(wave))
144144
data <- panelr::panel_data(data, !! sym(id), !! sym(wave))
145145
} else {
146146
wave <- panelr::get_wave(data)
@@ -167,7 +167,7 @@ dpm <- function(formula, data, error.inv = FALSE, const.inv = FALSE,
167167
pf <- formula_parser(formula, dv, data)
168168

169169
# Need to add interaction variables to data frame before calling model_frame
170-
if (length(pf$wint_labs) > 0 | length(pf$cint_labs) > 0 |
170+
if (length(pf$wint_labs) > 0 || length(pf$cint_labs) > 0 ||
171171
length(pf$bint_labs) > 0) {
172172
for (int in c(pf$wint_labs, pf$cint_labs, pf$bint_labs)) {
173173
new_name <- make_names(int, TRUE)

man/dpm-methods.Rd

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dpm_tidiers.Rd

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_syntax.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_wide_data.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/reexports.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/summary.dpm.Rd

+11-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)