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

2021-12-03 Thread Fox, John
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, cap

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

2021-12-03 Thread Fox, John
= "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 D

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

2021-12-03 Thread Fox, John
https://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
> $ :List of 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(){ + warning("warn

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

2020-06-11 Thread Fox, John
: 6 >> >> >> 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/dow

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 ty

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
> On 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
0.1 CRAN package yet, and no nightly 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 follo

[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", comman

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 be

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

2019-09-17 Thread Fox, John
gt; 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
ntrasts can 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 mor

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 sho

[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 cha

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 auth

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 th

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

2019-02-22 Thread Fox, John
to its quoted 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 > Subje

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: - - - - s

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 exam

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

2017-11-07 Thread Fox, John
- coef() vs coef() > > >>>>> Martin Maechler > >>>>> on Thu, 2 Nov 2017 21:59:00 +0100 writes: > > >>>>> Fox, John > >>>>> on Thu, 14 Sep 2017 13:46:44 + writes: > > >> Dear Martin, I m

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 > Cc: Martin Maechler ; Therneau, Terry M., > Ph.D. ; r-devel@r-pro

Re: [Rd] vcov and survival

2017-09-14 Thread Fox, John
> -Original Message- > From: Therneau, Terry M., Ph.D. [mailto:thern...@mayo.edu] > Sent: Thursday, September 14, 2017 8:41 AM > To: Martin Maechler > Cc: Fox, John ; Therneau, Terry M., Ph.D. > ; r-devel@r-project.org > Subject: Re: [Rd] vcov and survival > >

Re: [Rd] vcov and survival

2017-09-14 Thread Fox, John
> Sent: Thursday, September 14, 2017 4:23 AM > To: Martin Maechler > Cc: Fox, John ; Therneau, Terry M., Ph.D. > ; r-devel@r-project.org > Subject: Re: [Rd] vcov and survival > > >>>>> Martin Maechler > >>>>> on Thu, 14 Sep 2017 10:13:02 +020

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: [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), data=dat) >>summary(res) >> would reproduce the SPSS Beta values. >

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
ssion info: - snip - > Sys.info() sysname release version nodename "Windows" "10 x64""build 14393" "JOHN-CARBON-X1" machinelogin user effectiv

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, Professo

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 b