From df58ece6af7e83217a13fbf69218bb5d62fb7181 Mon Sep 17 00:00:00 2001 From: Michael Friendly Date: Fri, 12 May 2023 15:10:33 -0400 Subject: [PATCH] fix duplicate @return for glance/tidy --- CRAN-SUBMISSION | 4 ++-- R/nestedMethods.R | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 28e82d9..41f495c 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 0.2.1 -Date: 2023-05-11 16:40:33 UTC -SHA: 4c83faaae5fa16984c904e6e2988d378117e04cc +Date: 2023-05-12 15:10:14 UTC +SHA: d03d882fa8a7636e55850f36fafe9715effe9d37 diff --git a/R/nestedMethods.R b/R/nestedMethods.R index dd53455..993b40e 100644 --- a/R/nestedMethods.R +++ b/R/nestedMethods.R @@ -45,7 +45,7 @@ #' @param subset optional updated subset argument. #' @param contrasts optional updated contrasts argument. #' @param \dots arguments to be passed down. -#' +#' #' @return \itemize{ #' \item The \code{coef} and \code{vcov} methods return either matrices or lists of regression #' coefficients and their covariances, respectively. @@ -54,7 +54,6 @@ #' \item The \code{predict} and \code{fitted} methods return either a matrix of predicted probabilities or an #' object of class \code{"predictDichotomies"}, which is a named list with predicted logits for #' each nested-dichotomy model. -#' \item The \code{glance} and \code{tidy} methods return 'tibbles' containing model summaries. #' \item The \code{summary} method returns an object of class \code{"summary.nestedLogit"}, which is #' a list of summaries of the \code{\link{glm}} objects that comprise the nested-dichotomies model; the #' object is normally printed. @@ -92,7 +91,7 @@ #' broom::tidy(m) #' #' # predicted probabilities and ploting -#' head(predict(m)) # fitted probabilities for first few cases; +#' head(predict(m)) # fitted probabilities for first few cases; #' # equivalent to head(fitted(m)) #' new <- expand.grid(parentdeg=c("l.t.highschool", "highschool", #' "college", "graduate"), @@ -121,7 +120,7 @@ print.nestedLogit <- function(x, ...) { summary.nestedLogit <- function(object, ...) { result <- lapply(models(object), summary, ...) for (i in seq_along(result)) { - result[[i]]$dichotomy <- models(object, i)$dichotomy + result[[i]]$dichotomy <- models(object, i)$dichotomy } class(result) <- "summary.nestedLogit" attr(result, "formula") <- object$formula @@ -187,7 +186,7 @@ predict.nestedLogit <- function(object, newdata, model=c("nested", "dichotomies" for (i in seq_along(models(object))) { p <- predict(models(object, i), newdata = newdata, type = "response") p <- cbind(1 - p, p) - attr(p, "columns") <- models(object, i)$dichotomy + attr(p, "columns") <- models(object, i)$dichotomy fitted[[i]] <- p } response.levels <- @@ -197,7 +196,7 @@ predict.nestedLogit <- function(object, newdata, model=c("nested", "dichotomies" colnames(p) <- response.levels for (level in response.levels) { for (i in seq_along(models(object))) { - which <- sapply(models(object, i)$dichotomy, function(x) + which <- sapply(models(object, i)$dichotomy, function(x) level %in% x) if (!any(which)) next @@ -319,7 +318,7 @@ as.character.dichotomies <- function(x, ...) { for (i in seq_along(x)) { result <- paste0(result, names(x[i]), " = ", - "{", + "{", names(x[[i]][1L]), "{", paste(x[[i]][[1L]], collapse = " "),