Skip to content

Commit

Permalink
Add tidy.summary_emm() (#691)
Browse files Browse the repository at this point in the history
* Adds tidy-method form summary_emm-objects.

* Updates NEWS

* Apply suggestions from code review

Co-Authored-By: alex hayes <alexpghayes@gmail.com>

* Makes requested changes for emmeans tidiers. (#691)

- Adds joint_tests()-example
- Removes strict = FALSE from tests

* Roxygenizes documentation.
  • Loading branch information
crsh authored and alexpghayes committed Aug 15, 2019
1 parent f108d6c commit beab4ef
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 11 deletions.
5 changes: 5 additions & 0 deletions DESCRIPTION
Expand Up @@ -235,6 +235,11 @@ Authors@R:
family = "Szoecs",
role = "ctb",
email = "eduardszoecs@gmail.com"),
person(given = "Frederik",
family = "Aust",
role = "ctb",
email = "frederik.aust@uni-koeln.de",
comment = c(ORCID = "0000-0003-4900-788X")),
person(given = "Angus",
family = "Moore",
role = "ctb",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -205,6 +205,7 @@ S3method(tidy,summary.glht)
S3method(tidy,summary.lm)
S3method(tidy,summary.lm.beta)
S3method(tidy,summary.manova)
S3method(tidy,summary_emm)
S3method(tidy,survdiff)
S3method(tidy,survexp)
S3method(tidy,survfit)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -127,6 +127,8 @@ TODO: sort out what happens to `glance.aov()`

- `tidy.lmodel2()` now returns a `p.value` column (#570)

- Added `tidy.summary_emm()` (#691 by @crsh)

- `tidy.zoo()` now doesn't change column names that have spaces or other
special characters (previously they were converted to data.frame friendly
column names by `make.names`)
Expand Down
61 changes: 54 additions & 7 deletions R/emmeans-tidiers.R
Expand Up @@ -62,6 +62,9 @@
#' ggplot(tidy(by_price), aes(price2, estimate, color = day)) +
#' geom_line() +
#' geom_errorbar(aes(ymin = conf.low, ymax = conf.high))
#'
#' # joint_tests
#' tidy(joint_tests(oranges_lm1))
#'
#' @aliases emmeans_tidiers
#' @export
Expand Down Expand Up @@ -126,9 +129,43 @@ tidy.emmGrid <- function(x, ...) {
tidy_emmeans(x, ...)
}

#' @templateVar class summary_emm
#' @template title_desc_tidy
#'
#' @param x An `summary_emm` object.
#' @inherit tidy.lsmobj params examples details
#'
#' @evalRd return_tidy(
#' "std.error",
#' "df",
#' "num.df",
#' "den.df",
#' "conf.low",
#' "conf.high",
#' level1 = "One level of the factor being contrasted",
#' level2 = "The other level of the factor being contrasted",
#' "contrast",
#' term = "Model term in joint tests",
#' "p.value",
#' statistic = "T-ratio statistic or F-ratio statistic",
#' estimate = "Estimated least-squares mean."
#' )
#'
#' @export
#' @family emmeans tidiers
#' @seealso [tidy()], [emmeans::ref_grid()], [emmeans::emmeans()],
#' [emmeans::contrast()]
tidy.summary_emm <- function(x, ...) {
tidy_emmeans_summary(x, ...)
}

tidy_emmeans <- function(x, ...) {
s <- summary(x, ...)
ret <- as.data.frame(s)
tidy_emmeans_summary(s)
}

tidy_emmeans_summary <- function(x) {
ret <- as.data.frame(x)
repl <- list(
"lsmean" = "estimate",
"emmean" = "estimate",
Expand All @@ -137,17 +174,27 @@ tidy_emmeans <- function(x, ...) {
"SE" = "std.error",
"lower.CL" = "conf.low",
"upper.CL" = "conf.high",
"t.ratio" = "statistic"
"t.ratio" = "statistic",
"F.ratio" = "statistic",
"df1" = "num.df",
"df2" = "den.df",
"model term" = "term"
)

if ("contrast" %in% colnames(ret) &&
all(stringr::str_detect(ret$contrast, " - "))) {
all(stringr::str_detect(ret$contrast, " - "))) {
ret <- tidyr::separate_(ret, "contrast",
c("level1", "level2"),
sep = " - "
c("level1", "level2"),
sep = " - "
)
}

colnames(ret) <- dplyr::recode(colnames(ret), !!!(repl))

if("term" %in% colnames(ret)) {
ret <- ret %>%
mutate(term = stringr::str_trim(term))
}

as_tibble(ret)
}
3 changes: 3 additions & 0 deletions man/broom.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/tidy.emmGrid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/tidy.lsmobj.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/tidy.ref.grid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 96 additions & 0 deletions man/tidy.summary_emm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion tests/testthat/test-emmeans.R
Expand Up @@ -11,6 +11,10 @@ rg <- ref.grid(fit)

marginal <- lsmeans(rg, "day")

marginal_summary <- summary(marginal)

joint_tests_summary <- joint_tests(fit)

# generate dataset with dashes
marginal_dashes <- tibble(
y = rnorm(100),
Expand All @@ -30,7 +34,7 @@ test_that("tidy.lsmobj", {
tdm <- tidy(marginal)
tdmd <- tidy(marginal_dashes)
tdc <- tidy(contrast(marginal, method = "pairwise"))

check_tidy_output(tdm, strict = FALSE)
check_tidy_output(tdmd, strict = FALSE)
check_tidy_output(tdc, strict = FALSE)
Expand All @@ -45,3 +49,14 @@ test_that("ref.grid tidiers work", {
check_tidy_output(td, strict = FALSE)
check_dims(td, 36, 7)
})

test_that("summary_emm tidiers work", {
tdm <- tidy(marginal)
tdms <- tidy(marginal_summary)

expect_identical(tdm, tdms)

tdjt <- tidy(joint_tests_summary)
check_tidy_output(tdjt)
check_dims(tdjt, 2, 5)
})

1 comment on commit beab4ef

@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/aaa-documentation-helper.R:49:7: warning: local variable ‘overwritten’ assigned but may not be used

overwritten <- paste(overwrite, collapse = ", ")
      ^~~~~~~~~~~

R/aaa-documentation-helper.R:74:47: warning: no visible binding for global variable ‘description’

items <- with(glos, purrr::map2_chr(column, description, row_to_item))
                                              ^~~~~~~~~~~

R/boot-tidiers.R:63:3: warning: local variable ‘sim’ assigned but may not be used

sim <- boot.out$sim
  ^~~

R/boot-tidiers.R:64:3: warning: local variable ‘cl’ assigned but may not be used

cl <- boot.out$call
  ^~

R/boot-tidiers.R:69:3: warning: local variable ‘rn’ assigned but may not be used

rn <- paste("t", index, "*", sep = "")
  ^~

R/boot-tidiers.R:117:7: style: Place a space before left parenthesis, except in a function call.

if(conf.method == "norm"){
      ^

R/broom-package.R:45:1: style: Trailing blank lines are superfluous.

^

R/broom.R:40:1: style: Trailing blank lines are superfluous.

^

R/emmeans-tidiers.R:194:5: style: Place a space before left parenthesis, except in a function call.

if("term" %in% colnames(ret)) {
    ^

R/epiR-tidiers.R:9:1: style: Lines should not be more than 100 characters.

#' @evalRd return_tidy("term", estimate = "Estimated measure of association", "conf.low", "conf.high", "statistic", "df", "p.value")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/epiR-tidiers.R:11:1: style: Lines should not be more than 100 characters.

#' @details The tibble has a column for each of the measures of association or tests contained in `massoc` when 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/epiR-tidiers.R:27:60: style: Commas should always have a space after.

tidy.epi.2by2 <- function(x, parameters = c("moa", "stat"),...) {
                                                           ^

R/hmisc-tidiers.R:61:1: style: Trailing blank lines are superfluous.

^

R/hmisc-tidiers.R:62:1: style: Trailing blank lines are superfluous.

^

R/lavaan-tidiers.R:97:1: style: Lines should not be more than 100 characters.

#' For further recommendations on reporting SEM and CFA models see Schreiber, J. B. (2017). Update to core reporting practices in structural equation modeling. Research in Social and Administrative Pharmacy, 13(3), 634-643. https://doi.org/10.1016/j.sapharm.2016.06.006
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/lfe-tidiers.R:52:5: style: Place a space before left parenthesis, except in a function call.

if(has_multi_response) {
    ^

R/lfe-tidiers.R:76:1: style: Lines should not be more than 100 characters.

​      select(term, contains("effect"),  contains("se"), obs, comp) %>% # effect and se are multiple if multiple y
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/lfe-tidiers.R:77:15: style: Put spaces around all infix operators.

​      rename(N=obs) 
             ~^~

R/lfe-tidiers.R:79:7: style: Place a space before left parenthesis, except in a function call.

if(has_multi_response) {
      ^

R/lfe-tidiers.R:82:70: style: Put spaces around all infix operators.

tidyr::separate(col = "stat_resp", c("stat", "response"), sep="\\.") %>% 
                                                                    ~^~

R/lfe-tidiers.R:84:9: style: Commented code should be removed.

# nn <-  c("response", nn)
        ^~~~~~~~~~~~~~~~~~~~~~~~

R/lfe-tidiers.R:156:5: style: Place a space before left parenthesis, except in a function call.

if(has_multi_response) {
    ^

R/lm-beta-tidiers.R:43:26: style: Remove spaces before the left parenthesis in a function call.

tidy.lm.beta <- function (x, conf.int = FALSE, conf.level = 0.95,
                         ^

R/lm-beta-tidiers.R:53:34: style: Remove spaces before the left parenthesis in a function call.

tidy.summary.lm.beta <- function (x, ...) {
                                 ^

R/lm-beta-tidiers.R:68:1: style: Trailing blank lines are superfluous.

^

R/mass-rlm-tidiers.R:96:1: style: Trailing blank lines are superfluous.

^

R/mass-rlm-tidiers.R:97:1: style: Trailing blank lines are superfluous.

^

R/mediate-tidiers.R:10:1: style: Lines should not be more than 100 characters.

#' @details The tibble has four rows. The first two indicate the mediated effect in the control and treatment group, respectively. And the last two the direct effect in each group.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/mediate-tidiers.R:28:1: style: Lines should not be more than 100 characters.

d0 <- d1 <- z0 <- z1 <- d0.sims <- d1.sims <- z0.sims <- z1.sims <- d0.p <- d1.p <- z0.p <- z1.p <- NULL
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/mediate-tidiers.R:34:21: style: Do not place spaces around code in parentheses or square brackets.

​             tibble( c("acme_0", "acme_1", "ade_0", "ade_1"), 
                    ^

R/mediate-tidiers.R:36:49: style: Commas should never have a space before.

​                     c(sd(d0.sims), sd(d1.sims) , sd(z0.sims), sd(z1.sims)),
                                               ~^

R/mediate-tidiers.R:40:5: style: Place a space before left parenthesis, except in a function call.

if(conf.int){
    ^

R/mediate-tidiers.R:41:28: style: Put spaces around all infix operators.

low <- (1 - conf.level)/2
                          ~^~

R/mediate-tidiers.R:44:50: style: Put spaces around all infix operators.

z.inv <- length(theta[theta < mean(theta)])/sims
                                                ~^~

R/mediate-tidiers.R:48:31: style: Opening curly braces should never go on their own line and should always be followed by a new line.

under <- 6 * (sum(U^2))^{3/2}
                              ^

R/mediate-tidiers.R:48:33: style: Put spaces around all infix operators.

under <- 6 * (sum(U^2))^{3/2}
                               ~^~

R/mediate-tidiers.R:48:35: style: Closing curly-braces should always be on their own line, unless it's followed by an else.

under <- 6 * (sum(U^2))^{3/2}
                                  ^

R/mediate-tidiers.R:50:47: style: Put spaces around all infix operators.

lower.inv <-  pnorm(z + (z + qnorm(low))/(1 - a * (z + qnorm(low))))
                                             ~^~

R/mediate-tidiers.R:50:48: style: Place a space before left parenthesis, except in a function call.

lower.inv <-  pnorm(z + (z + qnorm(low))/(1 - a * (z + qnorm(low))))
                                               ^

R/mediate-tidiers.R:51:7: warning: local variable ‘lower2’ assigned but may not be used

lower2 <- lower <- quantile(theta, lower.inv)
      ^~~~~~

R/mediate-tidiers.R:52:48: style: Put spaces around all infix operators.

upper.inv <-  pnorm(z + (z + qnorm(high))/(1 - a * (z + qnorm(high))))
                                              ~^~

R/mediate-tidiers.R:52:49: style: Place a space before left parenthesis, except in a function call.

upper.inv <-  pnorm(z + (z + qnorm(high))/(1 - a * (z + qnorm(high))))
                                                ^

R/mediate-tidiers.R:53:7: warning: local variable ‘upper2’ assigned but may not be used

upper2 <- upper <- quantile(theta, upper.inv)
      ^~~~~~

R/mediate-tidiers.R:58:7: style: Place a space before left parenthesis, except in a function call.

if(s$boot.ci.type != "bca"){
      ^

R/mgcv-tidiers.R:53:1: style: Lines should not be more than 100 characters.

CI <- suppressMessages(stats::confint.default(x, level = conf.level)[rownames(px), ,drop = FALSE])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/mgcv-tidiers.R:53:91: style: Commas should always have a space after.

CI <- suppressMessages(stats::confint.default(x, level = conf.level)[rownames(px), ,drop = FALSE])
                                                                                          ^

R/muhaz-tidiers.R:53:1: style: Trailing blank lines are superfluous.

^

R/nobs.R:1:1: style: Lines should not be more than 100 characters.

#`stats::nobs` is a standard function to retrieve the number of observations used to fit a model. Unfortunately, Some packages do not define a `stats::nobs.MODEL` method. This file fills-in those missing methods. Ideally, we should offload these methods by submitting them for adoption in the upstream packages.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/pam-tidiers.R:11:1: style: Lines should not be more than 100 characters.

#'   max.diss = "Maximal dissimilarity between the observations in the cluster and that cluster's medoid.",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/pam-tidiers.R:12:1: style: Lines should not be more than 100 characters.

#'   avg.diss = "Average dissimilarity between the observations in the cluster and that cluster's medoid.", 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/plm-tidiers.R:80:41: style: Only use double-quotes.

ret <- tibble(r.squared = s$r.squared['rsq'],
                                        ^~~~~

R/plm-tidiers.R:81:45: style: Only use double-quotes.

adj.r.squared = s$r.squared['adjrsq'],
                                            ^~~~~~~~

R/quantreg-rq-tidiers.R:13:1: style: Lines should not be more than 100 characters.

#'   `summary.rq` and `statistic` and `p.value` values are not returned. When only a single predictor is included in the model, 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/quantreg-rqs-tidiers.R:83:1: style: Trailing blank lines are superfluous.

^

R/robust-glmrob-tidiers.R:22:25: style: Remove spaces before the left parenthesis in a function call.

tidy.glmRob <- function (x, ...){
                        ^

R/robust-glmrob-tidiers.R:68:3: warning: local variable ‘s’ assigned but may not be used

s <- summary(x)
  ^

R/robust-lmrob-tidiers.R:23:24: style: Remove spaces before the left parenthesis in a function call.

tidy.lmRob <- function (x, ...){
                       ^

R/robustbase-glmrob-tidiers.R:19:25: style: Remove spaces before the left parenthesis in a function call.

tidy.glmrob <- function (x, conf.int = FALSE, conf.level = 0.95, ...) {
                        ^

R/sp-tidiers.R:58:5: warning: local variable ‘order’ assigned but may not be used

order <- 1:nrow(pieces)
    ^~~~~

R/sp-tidiers.R:61:5: warning: local variable ‘group’ assigned but may not be used

group <- interaction(id, piece)
    ^~~~~

R/sp-tidiers.R:95:5: warning: local variable ‘order’ assigned but may not be used

order <- 1:nrow(pieces)
    ^~~~~

R/sp-tidiers.R:98:5: warning: local variable ‘group’ assigned but may not be used

group <- interaction(id, piece)
    ^~~~~

R/speedglm-speedglm-tidiers.R:85:1: style: Trailing blank lines are superfluous.

^

R/speedglm-speedlm-tidiers.R:78:8: style: Commented code should be removed.

#    speedglm::speedglm(hp ~ log(mpg), mtcars, fitted = TRUE)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/speedglm-speedlm-tidiers.R:97:1: style: Trailing blank lines are superfluous.

^

R/stats-anova-tidiers.R:73:5: style: Place a space before left parenthesis, except in a function call.

if("term" %in% names(ret)){
    ^

R/stats-glm-tidiers.R:107:3: warning: local variable ‘s’ assigned but may not be used

s <- summary(x)
  ^

R/stats-kmeans-tidiers.R:5:1: style: Lines should not be more than 100 characters.

#' @param col.names Dimension names. Defaults to the names of the variables in x.  Set to NULL to get names `x1, x2, ...`.
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-kmeans-tidiers.R:34:5: style: Place a space before left parenthesis, except in a function call.

if(is.null(col.names)){
    ^

R/stats-lm-tidiers.R:148:1: style: Lines should not be more than 100 characters.

#'   df = "The degrees for freedom from the numerator of the overall F-statistic. This is new in broom 0.7.0. Previously, this reported the rank of the design matrix, which is one more than the numerator degrees of freedom of the overall F-statistic.",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-lm-tidiers.R:186:3: style: Commented code should be removed.

# getAnywhere('format.perc')
  ^~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-loess-tidiers.R:43:1: style: Trailing blank lines are superfluous.

^

R/stats-mlm-tidiers.R:35:4: style: Commented code should be removed.

#ret <- tidy.summary.mlm(s)
   ^~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-prcomp-tidiers.R:50:1: style: Lines should not be more than 100 characters.

#' @details See https://stats.stackexchange.com/questions/134282/relationship-between-svd-and-pca-how-to-use-svd-to-perform-pca
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-tidiers.R:29:1: style: Lines should not be more than 100 characters.

#' function is an `nXm` matrix, as opposed to a `1Xm` vector, the input matrix is first flattened into a `1X(m*n)` vector
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R/stats-tidiers.R:73:34: style: Only use double-quotes.

ret <- as_tibble(m, rownames = 'item1')
                                 ^~~~~~~

R/stats-tidiers.R:87:1: style: Trailing blank lines are superfluous.

^

R/stats-tidiers.R:88:1: style: Trailing blank lines are superfluous.

^

R/stats-tidiers.R:89:1: style: Trailing blank lines are superfluous.

^

R/stats-tidiers.R:90:1: style: Trailing blank lines are superfluous.

^

R/survival-survreg-tidiers.R:43:5: style: Place a space before left parenthesis, except in a function call.

if(conf.int){
    ^

R/systemfit-tidiers.R:61:1: style: Trailing blank lines are superfluous.

^

R/utilities.R:6:5: style: Commented code should be removed.

#   mouse = gerbil
    ^~~~~~~~~~~~~~

R/utilities.R:433:32: style: Do not place spaces around code in parentheses or square brackets.

if (identical(x, quote(expr = ))) {
                               ^

tests/spelling.R:1:3: style: Place a space before left parenthesis, except in a function call.

if(requireNamespace('spelling', quietly = TRUE))
  ^

tests/spelling.R:1:21: style: Only use double-quotes.

if(requireNamespace('spelling', quietly = TRUE))
                    ^~~~~~~~~~

tests/testthat/test-aer.R:71:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-drc.R:9:16: style: Put spaces around all infix operators.

mod <- drm(dead/total~conc, type,
              ~^~

tests/testthat/test-epiR.R:5:20: style: Commas should always have a space after.

dat <- matrix(c(13,2163,5,3349), nrow = 2, byrow = TRUE)
                   ^

tests/testthat/test-epiR.R:5:25: style: Commas should always have a space after.

dat <- matrix(c(13,2163,5,3349), nrow = 2, byrow = TRUE)
                        ^

tests/testthat/test-epiR.R:5:27: style: Commas should always have a space after.

dat <- matrix(c(13,2163,5,3349), nrow = 2, byrow = TRUE)
                          ^

tests/testthat/test-epiR.R:13:49: style: Commas should always have a space after.

birthwt$low <- factor(birthwt$low, levels = c(1,0))
                                                ^

tests/testthat/test-epiR.R:14:53: style: Commas should always have a space after.

birthwt$smoke <- factor(birthwt$smoke, levels = c(1,0))
                                                    ^

tests/testthat/test-epiR.R:15:51: style: Commas should always have a space after.

birthwt$race <- factor(birthwt$race, levels = c(1,2,3))
                                                  ^

tests/testthat/test-epiR.R:15:53: style: Commas should always have a space after.

birthwt$race <- factor(birthwt$race, levels = c(1,2,3))
                                                    ^

tests/testthat/test-ergm.R:29:5: style: Commented code should be removed.

# check_dims(tde, 2, 7)
    ^~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-ergm.R:37:5: style: Commented code should be removed.

# check_dims(td2, 2, 7)
    ^~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-gam.R:30:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-joineRML.R:11:3: style: Commented code should be removed.

# `R/sysdata.rda`
  ^~~~~~~~~~~~~~~

tests/testthat/test-lfe.R:20:37: style: Commas should never have a space before.

fit_multi <- lfe::felm(v1 + v2 ~ v3 , df)
                                   ~^

tests/testthat/test-lfe.R:80:1: style: Lines should not be more than 100 characters.

​  expect_error(augment(fit_multi), "Augment does not support linear models with multiple responses.")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mass-polr.R:47:37: style: Only use double-quotes.

au <- augment(fit, type.predict = 'class')
                                    ^~~~~~~

tests/testthat/test-mass-polr.R:48:25: style: Only use double-quotes.

​  expect_is(au$.fitted, 'factor')
                        ^~~~~~~~

tests/testthat/test-mass-polr.R:49:36: style: Only use double-quotes.

​  expect_equal(predict(fit, type = 'class'), au$.fitted)
                                   ^~~~~~~

tests/testthat/test-mediate.R:37:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-mgcv.R:27:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-mgcv.R:28:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-muhaz.R:30:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-orcutt.R:28:51: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​test_that("no effect from additional parameters", { # from issue 734
                                                  ^

tests/testthat/test-ordinal.R:42:1: style: Lines should not be more than 100 characters.

info = "The terms (and their order) should be unaffected by whether `conf.int` = TRUE or `conf.int` = FALSE.")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-ordinal.R:94:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-pam.R:39:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-plm.R:43:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-polca.R:42:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-polca.R:43:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-quantreg-rq.R:14:16: style: Put spaces around all infix operators.

dflarge_n <- df%>% slice(rep(row_number(), 500))
              ~^

tests/testthat/test-robust.R:63:66: style: Opening curly braces should never go on their own line and should always be followed by a new line.

​test_that("no more rlang issues with model objects from robust", { # from issue 720
                                                                 ^

tests/testthat/test-robustbase.R:18:5: style: Commented code should be removed.

# check_arguments(glance.glmrob)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-sp.R:99:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-speedglm-speedlm.R:59:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-stats-anova.R:94:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-stats-glm.R:68:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-stats-htest.R:65:5: style: Commented code should be removed.

# gl <- glance(pht)
    ^~~~~~~~~~~~~~~~~

tests/testthat/test-stats-htest.R:75:5: style: Commented code should be removed.

# gl <- glance(ptt)
    ^~~~~~~~~~~~~~~~~

tests/testthat/test-stats-htest.R:117:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-stats-prcomp.R:69:30: style: Place a space before left parenthesis, except in a function call.

C <- chol(S <- toeplitz(.9^(0:31)))
                             ^

tests/testthat/test-survival-survdiff.R:63:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-survival-survexp.R:34:1: style: Trailing blank lines are superfluous.

^

tests/testthat/test-survival-survfit.R:49:1: style: Trailing blank lines are superfluous.

^

Please sign in to comment.