Re: [Rd] capturing multiple warnings in tryCatch()

2021-12-03 Thread Fox, John
ll the best, Adrian On Fri, 3 Dec 2021 at 21:42, Fox, John wrote: > Dear Adrian, > > Here's my slightly modified version of your function, which serves my > purpose: > > --- snip --- > > tryCatchWEM <- function (expr, capture = TRU

Re: [Rd] capturing multiple warnings in tryCatch()

2021-12-03 Thread Fox, John
ot;output"){ toreturn$output <- capture.output(output$value) } else if (capture == "value"){ toreturn$value <- output$value } . . . Best, John On 2021-12-03, 1:56 PM, "R-devel on behalf of Adrian Dușa" wrote: On Fri, 3 Dec 20

Re: [Rd] capturing multiple warnings in tryCatch()

2021-12-03 Thread Fox, John
://stat.ethz.ch/pipermail/r-help/2010-December/262626.html [3] https://stat.ethz.ch/pipermail/r-help/2004-June/052092.html [4] https://stat.ethz.ch/pipermail/r-help/2004-June/052132.html [5] https://CRAN.R-project.org/package=simsalapar Hope this helps, Rui Barradas À

Re: [Rd] capturing multiple warnings in tryCatch()

2021-12-02 Thread Fox, John
f 2 > ..$ message: chr "warning 2" > ..$ call : language foo() > ..- attr(*, "class")= chr [1:3] "simpleWarning" "warning" "condition" > > Cheers, > Simon > > &

[Rd] capturing multiple warnings in tryCatch()

2021-12-02 Thread Fox, John
Dear R-devel list members, Is it possible to capture more than one warning message using tryCatch()? The answer may be in ?conditions, but, if it is, I can't locate it. For example, in the following only the first warning message is captured and reported: > foo <- function(){ +

Re: [Rd] tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"

2020-06-11 Thread Fox, John
;> >> I don't know whether this is a red herring or not, but the >> Console fails to boot. >> >> John does it work for you? >> >> Not sure whether Python has the same trouble. Kind of old info at >> https://www.python.org/download/mac/tcltk/ >>

Re: [Rd] tcltk image reading problem (on a mac?): [tcl] encountered an unsupported criticial chunk type "eXIf"

2020-06-11 Thread Fox, John
Dear Wayne and Peter, FWIW, I observe exactly the same problem in Catalina. The error and my session info: snip > tkimage.create("photo", file = fname) Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] encountered an unsupported criticial chunk

Re: [Rd] [R] R 4.0.2 scheduled for June 22

2020-06-09 Thread Fox, John
Dear Peter, Thank you very much for this. To clarify slightly, the bug affects not just the Rcmdr package but use of the tcltk package on Windows more generally. Best, John - John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada Web:

Re: [Rd] [External] use of the tcltk package crashes R 4.0.1 for Windows

2020-06-08 Thread Fox, John
Dear Jeroen, With the caveat that I've tested only a few of the Rcmdr dialogs (a full test takes hours and must be done manually), everything seems to be working fine again. Thank you for addressing this problem so quickly. John - John Fox, Professor Emeritus

Re: [Rd] [External] Re: use of the tcltk package crashes R 4.0.1 for Windows

2020-06-07 Thread Fox, John
Hi, Does it make sense to withdraw the Windows R 4.0.1 binary until the issue is resolved? Best, John > -Original Message- > From: luke-tier...@uiowa.edu > Sent: Sunday, June 7, 2020 11:54 AM > To: peter dalgaard > Cc: Jeroen Ooms ; Fox, John ; r- > de...@r-pro

Re: [Rd] use of the tcltk package crashes R 4.0.1 for Windows

2020-06-07 Thread Fox, John
Jun 7, 2020, at 10:00 AM, Jeroen Ooms wrote: > > On Sun, Jun 7, 2020 at 3:13 AM Fox, John wrote: >> >> Hi, >> >> The following code, from the examples in ?TkWidgets , immediately crashes R >> 4.0.1 for Windows: >> >> -

Re: [Rd] use of the tcltk package crashes R 4.0.1 for Windows

2020-06-07 Thread Fox, John
ightly build of 4.0.1 Patched, >> but the only thing changed in the sources since r78644 is the VERSION file.) >> >> -pd >> >>> On 7 Jun 2020, at 03:13 , Fox, John wrote: >>> >>> Hi, >>> >>> The following code, from the examples i

[Rd] use of the tcltk package crashes R 4.0.1 for Windows

2020-06-06 Thread Fox, John
Hi, The following code, from the examples in ?TkWidgets , immediately crashes R 4.0.1 for Windows: - snip library("tcltk") tt <- tktoplevel() label.widget <- tklabel(tt, text = "Hello, World!") button.widget <- tkbutton(tt, text = "Push",

Re: [Rd] Tcl.Tk Tktable package missing from R 4.0.0 on Windows

2020-05-04 Thread Fox, John
plan to pursue that possibility. Best, John > On May 4, 2020, at 3:01 AM, Jeroen Ooms wrote: > > On Sun, May 3, 2020 at 6:15 PM Fox, John wrote: >> >> Dear R-devel list members, >> >> The Tktable package for Tcl/Tk is apparently missing from the Windows >&g

[Rd] Tcl.Tk Tktable package missing from R 4.0.0 on Windows

2020-05-03 Thread Fox, John
Dear R-devel list members, The Tktable package for Tcl/Tk is apparently missing from the Windows distribution of R 4.0.0. I (actually a user of the Rcmdr package) discovered this when trying to use the new-data-set dialog in the Rcmdr package, producing the error, "Tcl package 'Tktable' must

Re: [R-pkg-devel] translation .mo files

2020-02-10 Thread Fox, John
Dear Paul, Here's some information that I prepared for translators of the Rcmdr package, slightly edited to make it more generic. Perhaps you'll find it useful: R provides a general facility for translating messages from English to other languages using the GNU gettext translation tools

Re: [R-pkg-devel] Appropriate usage of 'Suggests' -- package installed conditional on other software not found

2019-10-03 Thread Fox, John
Hi Dirk, > On Oct 3, 2019, at 10:20 AM, Dirk Eddelbuettel wrote: > > > Hi John, > > On 3 October 2019 at 13:56, Fox, John wrote: > | > On Oct 3, 2019, at 9:11 AM, Dirk Eddelbuettel wrote: > | > On 3 October 2019 at 10:10, Driver, Charles wrote: > | &

Re: [R-pkg-devel] Appropriate usage of 'Suggests' -- package installed conditional on other software not found

2019-10-03 Thread Fox, John
Dear Dirk, > On Oct 3, 2019, at 9:11 AM, Dirk Eddelbuettel wrote: > > > Charles, > > On 3 October 2019 at 10:10, Driver, Charles wrote: > | I have a function that outputs / compiles some latex. To do this I use > Sys.which('pdflatex') and if nothing is found, prompt the user whether to >

Re: [Rd] head.matrix can return 1000s of columns -- limit to n or add new argument?

2019-09-17 Thread Fox, John
x > On Sep 17, 2019, at 8:29 AM, Fox, John wrote: > > Dear Herve, > > The brief() generic function in the car package does something very similar > to that for data frames (and has methods for other classes of objects as > well). > > Best, > John > > -

Re: [Rd] head.matrix can return 1000s of columns -- limit to n or add new argument?

2019-09-17 Thread Fox, John
Dear Herve, The brief() generic function in the car package does something very similar to that for data frames (and has methods for other classes of objects as well). Best, John - John Fox, Professor Emeritus McMaster University Hamilton, Ontario, Canada

Re: [Rd] inconsistent handling of factor, character, and logical predictors in lm()

2019-08-31 Thread Fox, John
n be applied only to factors with 2 or more levels >> coef(lm(data=d, Weight ~ Age + factor(Diseased, levels=c(FALSE,TRUE)), > subset=Age<7)) > Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : > contrasts can be applied only to factors with 2 or more levels &

Re: [Rd] inconsistent handling of factor, character, and logical predictors in lm()

2019-08-31 Thread Fox, John
Dear Abby, > On Aug 30, 2019, at 8:20 PM, Abby Spurdle wrote: > >> I think that it would be better to handle factors, character predictors, and >> logical predictors consistently. > > "logical predictors" can be regarded as categorical or continuous (i.e. 0 or > 1). > And the model matrix

[Rd] inconsistent handling of factor, character, and logical predictors in lm()

2019-08-30 Thread Fox, John
Dear R-devel list members, I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a

Re: [Rd] Could generic functions check different S3 methods for an object when one of them produces an error?

2019-06-18 Thread Fox, John
Dear Iago, The R S3 object system works as expected here, using the first available method processing the class vector from left to right. The problem is that the broom package doesn't export the confint.geeglm() method but rather reserves it for internal use. I can't think why the package

[R-pkg-devel] advice about errorCondition() function in the Rcmdr package

2019-05-14 Thread Fox, John
Dear list members, I noticed that there's a name clash between errorCondition() in the Rcmdr package and the new function by the same name in the base package in R 3.6.0. errorCondition() has been in the Rcmdr package for many years and is used extensively -- literally dozens of times. It's

Re: [Rd] default for 'signif.stars'

2019-03-28 Thread Fox, John
Dear all, I agree with both Russ and Terry that the significance stars option should default to FALSE. Here's what Sandy Weisberg and I say about significance starts in the current edition of the R Companion to Applied Regression: 'If you find the “statistical-significance” asterisks

Re: [Rd] model.matrix.default() silently ignores bad contrasts.arg

2019-02-22 Thread Fox, John
name) can be an element of the contrasts.arg list. Best, John > -Original Message- > From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] > Sent: Friday, February 22, 2019 11:50 AM > To: Ben Bolker > Cc: Fox, John ; r-devel@r-project.org > Subject: Re: [Rd] mo

Re: [Rd] Return/print standard error in t.test()

2019-02-21 Thread Fox, John
Dear Thomas, it is, unfortunately, not that simple. t.test() returns an object of class "htest" and not all such objects have standard errors. I'm not entirely sure what the point is since it's easy to compute the standard error of the difference from the information in the object (adapting an

Re: [Rd] model.matrix.default() silently ignores bad contrasts.arg

2019-02-21 Thread Fox, John
Dear Ben, Perhaps I'm missing the point, but contrasts.arg is documented to be a list. From ?model.matrix: "contrasts.arg: A list, whose entries are values (numeric matrices or character strings naming functions) to be used as replacement values for the contrasts replacement function and whose

Re: [Rd] formula(model.frame(..)) is misleading

2018-12-21 Thread Fox, John
Dear Martin, Since no one else has picked up on this, I’ll take a crack at it: The proposal is to define the S3 class of model-frame objects as c(“model.frame”, “data.frame”) (not the formal class of these objects, even though this feature was coincidentally introduced in S4). That’s unlikely

[Rd] logical variables in models

2018-12-19 Thread Fox, John
Dear R-devel list members, This is an observation about how logical variables in models are handled, followed by questions. As a general matter, character variables and logical variables are treated as if they were factors when they appear on the RHS of a model formula; for example: - - - -

Re: [Rd] Documentation examples for lm and glm

2018-12-17 Thread Fox, John
my opinion. Best, John > > regards, > > Heinz > > ### trivial example > plotwithline <- function(x, y) { >plot(x, y) >abline(lm(y~x)) ## data argument? > } > > set.seed(25) > df0 <- data.frame(x=rnorm(20), y=rnorm(20)) > > plotwithli

Re: [Rd] Documentation examples for lm and glm

2018-12-17 Thread Fox, John
Dear Steve, Since this relates as well to the message I posted a couple of minutes before yours, I agree that it’s possible to phrase “best practices” too categorically. In the current case, I believe that it’s reasonable to say that specifying the data argument is “generally” or “usually” the

Re: [Rd] Documentation examples for lm and glm

2018-12-17 Thread Fox, John
Dear Martin, I think that everyone agrees that it’s generally preferable to use the data argument to lm() and I have nothing significant to add to the substance of the discussion, but I think that it’s a mistake not to add to the current examples, for the following reasons: (1) Relegating

Re: [R-pkg-devel] creating a link to a vignette in a .Rd file

2018-11-20 Thread Fox, John
eorgi Boshnakov > > > -Original Message- > From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On > Behalf Of Fox, John > Sent: 20 November 2018 01:16 > To: Hadley Wickham > Cc: R Package Development > Subject: Re: [R-pkg-devel] creating a link

Re: [R-pkg-devel] creating a link to a vignette in a .Rd file

2018-11-19 Thread Fox, John
of queries in a web search but no solution. Thanks for this, John > -Original Message- > From: Hadley Wickham [mailto:h.wick...@gmail.com] > Sent: Monday, November 19, 2018 6:21 PM > To: Fox, John > Cc: R Package Development > Subject: Re: [R-pkg-devel] creating a

[R-pkg-devel] creating a link to a vignette in a .Rd file

2018-11-19 Thread Fox, John
Dear r-package-devel list members, I'd like to create a link to a package vignette from a help file in the same package, for example to the "partial-residuals" vignette in the effects package from effect.Rd. I'm able to generate a URL for the vignette as follows:

Re: [R-pkg-devel] Trying to work around missing functionality

2018-08-27 Thread Fox, John
Hi John, It's possible that I didn’t follow what you did, but it appears as if you call globalVariables() *inside* the function. Instead try to do as Richard Heiberger suggested and place the call outside of the function, e.g., in a source file in the package R directory named globals.R. (Of

Re: [R-pkg-devel] Package builds, installs, and runs but does not pass devtools::check()

2018-07-16 Thread Fox, John
Dear Michael, You could add a call to globalVariables() in the package sources for cases like this. I hope this helps, John - John Fox Professor Emeritus McMaster University Hamilton, Ontario, Canada Web:

Re: [Rd] New vcov(*, complete=TRUE) etc -- coef() vs coef()

2017-11-07 Thread Fox, John
complete=TRUE) etc -- coef() vs coef() > > >>>>> Martin Maechler <maech...@stat.math.ethz.ch> > >>>>> on Thu, 2 Nov 2017 21:59:00 +0100 writes: > > >>>>> Fox, John <j...@mcmaster.ca> > >>>>> on Thu, 1

Re: [Rd] vcov and survival

2017-11-02 Thread Fox, John
Dear Martin, Thank you for taking care of this. Best, John > -Original Message- > From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] > Sent: Thursday, November 2, 2017 4:59 PM > To: Fox, John <j...@mcmaster.ca> > Cc: Martin Maechler <maech...@stat.math.e

Re: [Rd] vcov and survival

2017-09-14 Thread Fox, John
age- > From: Therneau, Terry M., Ph.D. [mailto:thern...@mayo.edu] > Sent: Thursday, September 14, 2017 8:41 AM > To: Martin Maechler <maech...@stat.math.ethz.ch> > Cc: Fox, John <j...@mcmaster.ca>; Therneau, Terry M., Ph.D. > <thern...@mayo.edu>; r-devel@r-

Re: [Rd] vcov and survival

2017-09-14 Thread Fox, John
tember 14, 2017 4:23 AM > To: Martin Maechler <maech...@stat.math.ethz.ch> > Cc: Fox, John <j...@mcmaster.ca>; Therneau, Terry M., Ph.D. > <thern...@mayo.edu>; r-devel@r-project.org > Subject: Re: [Rd] vcov and survival > > >>>>> Martin Maechler <ma

Re: [Rd] vcov and survival

2017-09-13 Thread Fox, John
Dear Terry, Even the behaviour of lm() and glm() isn't entirely consistent. In both cases, singularity results in NA coefficients by default, and these are reported in the model summary and coefficient vector, but not in the coefficient covariance matrix: > mod.lm <-

Re: [R-pkg-devel] Changing a package's name

2017-06-11 Thread Fox, John
Dear David, No one at CRAN has responded yet, so I'll take a stab at it. First, you're right about the resonance of "huxtable" for North Americans, and if the package were mine, I'd be slightly embarrassed about the name. CRAN generally will not allow you to rename a package, for several

Re: [Rd] lm() gives different results to lm.ridge() and SPSS

2017-05-05 Thread Fox, John
Dear Nick, On 2017-05-05, 9:40 AM, "R-devel on behalf of Nick Brown" wrote: >>I conjecture that something in the vicinity of >> res <- lm(DEPRESSION ~ scale(ZMEAN_PA) + scale(ZDIVERSITY_PA) + >>scale(ZMEAN_PA * ZDIVERSITY_PA),

Re: [R-pkg-devel] Problem in stats::model.matrix when omitting two-way interactions

2017-03-30 Thread Fox, John
Dear Paul, Isn't this really a question for r-help rather than r-package-devel? In any event, I think that your message is based on (an entirely understandable) misunderstanding of what the : operator on the right-hand side of a model formula does. The : operator is equivalent to %in%, and

Re: [R-pkg-devel] multiple bibentry()s in CITATION

2017-03-27 Thread Fox, John
Dear Martin, Thanks for following up on this. Best, John > -Original Message- > From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] > Sent: March 27, 2017 9:26 AM > To: Fox, John <j...@mcmaster.ca> > Cc: Martin Maechler <maech...@stat.math.eth

Re: [Rd] Strange behavior when using progress bar (Fwd: Re: [R] The code itself disappears after starting to execute the for loop)

2016-12-07 Thread Fox, John
: - snip - > Sys.info() sysname release version nodename "Windows" "10 x64""build 14393" "JOHN-CARBON-X1" machinelogin user effective_user

Re: [Rd] improve 'package not installed' load errors?

2016-10-24 Thread Fox, John
Dear Kevin, As others have mentioned, it's my sense that this kind of error has become more frequent -- at least I see students who encounter these errors more frequently. I agree that a less cryptic error message might help. Best, John -- John Fox,

Re: [Rd] suggested addition to model.matrix

2016-10-03 Thread Fox, John
Dear Spencer, I don't think that the problem of "converting a data frame into a model matrix" is well-defined, because there isn't a unique mapping from one to the other. In your example, you build the model matrix for the additive formula ~ a + b from the data frame matrix containing a and

[R-pkg-devel] multiple bibentry()s in CITATION

2016-09-02 Thread Fox, John
Dear list members, I've noticed that citation(package="pkg") generates both a text citation and a BiBTeX entry when the CITATION file contains a single call to bibentry() or citEntry(), but that only text citations are shown if there are multiple calls to bibentry() or citEntry(). Is this