Coder Social home page Coder Social logo

Comments (4)

HenrikBengtsson avatar HenrikBengtsson commented on May 27, 2024

Issue

> options(warnPartialMatchArgs = TRUE)
> example("deparse", package = "base")
[...]
Warning message:
In deparse(args(lm), width = 500) :
  partial argument match of 'width' to 'width.cutoff'

Action

from wishlist-for-r.

csgillespie avatar csgillespie commented on May 27, 2024

Following your twitter comment, I think this would detect any examples that don't play well partial arguments

test_example = function(function_name) {
  x = try(example(function_name, package = "stats", character.only = TRUE,
                  echo = FALSE, ask = FALSE, local = TRUE),
          silent = TRUE)
  if(class(x) == "try-error") return(function_name)
  else return(NULL)
}

options(warn=2)
options(warnPartialMatchArgs = TRUE)

tpkg = "stats"
funcs = getNamespaceExports(tpkg) 
bad_funcs = sapply(funcs, test_example)
as.vector(unlist(bad_funcs))

Also, even though local = TRUE and ask = FALSE my workspace is still filled up with "stuff" and I'm occasionally asked.

from wishlist-for-r.

HenrikBengtsson avatar HenrikBengtsson commented on May 27, 2024
> getRversion()
[1] ‘3.6.0’
options(warnPartialMatchDollar = TRUE, warn = 2L)
library(survival)
si <- sessionInfo()
utils::toLatex(si)
Error: (converted from warning) partial match of 'otherPkg' to 'otherPkgs'
> traceback()
8: doWithOneRestart(return(expr), restart)
7: withOneRestart(expr, restarts[[1L]])
6: withRestarts({
       .Internal(.signalCondition(simpleWarning(msg, call), msg, 
           call))
       .Internal(.dfltWarn(msg, call))
   }, muffleWarning = function() NULL)
5: .signalSimpleWarning("partial match of 'otherPkg' to 'otherPkgs'", 
       base::quote(NULL))
4: vapply(pdList, `[[`, "", "Version")
3: toLatexPDlist(object$otherPkg)
2: toLatex.sessionInfo(si)
1: utils::toLatex(si)

from wishlist-for-r.

HenrikBengtsson avatar HenrikBengtsson commented on May 27, 2024

From https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17767:

> library(nlme)
> fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
+            correlation = corAR1(form = ~ 1 | Mare),
+            weights = varIdent(form=~Mare))
> s <- summary(fm1)
> bfr <- utils::capture.output(print(s))
Warning message:
In coef.varIdent(x, uncons = FALSE, allCoef = TRUE) :
  partial argument match of 'uncons' to 'unconstrained'
> options(warn = 2L)
> bfr <- print(s)
> traceback()
12: doWithOneRestart(return(expr), restart)
11: withOneRestart(expr, restarts[[1L]])
10: withRestarts({
        .Internal(.signalCondition(simpleWarning(msg, call), msg, 
            call))
        .Internal(.dfltWarn(msg, call))
    }, muffleWarning = function() NULL)
9: .signalSimpleWarning("partial argument match of 'uncons' to 'unconstrained'", 
       base::quote(coef.varIdent(x, uncons = FALSE, allCoef = TRUE)))
8: coef(x, uncons = FALSE, allCoef = TRUE)
7: print.summary.varFunc(X[[i]], ...)
6: FUN(X[[i]], ...)
5: lapply(x, print, ...)
4: print.summary.modelStruct(summary(x$modelStruct), ...)
3: print(summary(x$modelStruct), ...)
2: print.summary.gls(s)
1: print(s)

So, this comes from calling nlme:::coef.varIdent();

> args(nlme:::coef.varIdent)
function (object, unconstrained = TRUE, allCoef = FALSE, ...)

with partial argument names in:

> nlme:::print.summary.varFunc
function (x, header = TRUE, ...) 
{
    ox <- x
    class(x) <- attr(x, "oClass")
    if (length(aux <- coef(x, uncons = FALSE, allCoef = TRUE)) > 
        0) {
        if (header) 
            cat("Variance function:\n")
        cat(paste(" Structure: ", attr(x, "structName"), "\n", 
            sep = ""))
        cat(paste(" Formula:", deparse(formula(x)), "\n"))
        cat(" Parameter estimates:\n")
        print(aux)
    }
    else {
        if (inherits(x, "varIdent")) {
            return()
        }
        cat("Variance function structure of class", class(x)[1], 
            "with no parameters, or uninitialized\n")
    }
    invisible(ox)
}
<bytecode: 0x55feea606078>
<environment: namespace:nlme>

from wishlist-for-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.