[Rd] Methods for objects inheriting from lme (nlme package)
Dear R developers, One function in my mkin package [1] returns an object that is originally created by nlme(), but contains some additional information. Its class is c("mmkin.nlme", "nlme", "lme"). Now I would like to use the anova() method for lme objects for comparing such S3 objects. Unfortunately, anova.lme currently does not check for inheritance, but checks the first element of the class attribute (as obtained by data.class()) against a hardcoded list of classes in order to decide if it will work or not. Therefore, I created a bug report [2], containing a patch [3] for nlme that makes anova.lme check for inheritance. Encouraged by a kind comment by Elin Waring in the BTS, I have now revisited my bug report, and discovered that the help page for data.class() claims that its return value (the first element of the class attribute vector) is "what is typically useful for method dispatching". However, I think that this use case illustrates that it would be useful not only to check for the primary class, but rather for class inheritance. Do you agree that it is preferable for the S3 method to check for inheritance instead of checking against a hardcoded list in this case? Kind regards, Johannes Ranke [1] https://github.com/jranke/mkin/blob/master/R/nlme.mmkin.R [2] https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17761 [3] https://bugs.r-project.org/bugzilla/attachment.cgi?id=2578 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Methods for objects inheriting from lme (nlme package)
Am Montag, 20. Juli 2020, 11:12:25 CEST schrieb Johannes Ranke: > Dear R developers, > > One function in my mkin package [1] returns an object that is originally > created by nlme(), but contains some additional information. Its class is > c("mmkin.nlme", "nlme", "lme"). > > Now I would like to use the anova() method for lme objects for comparing > such S3 objects. Unfortunately, anova.lme currently does not check for > inheritance, but checks the first element of the class attribute (as > obtained by data.class()) against a hardcoded list of classes in order to > decide if it will work or not. > > Therefore, I created a bug report [2], containing a patch [3] for nlme that > makes anova.lme check for inheritance. > > Encouraged by a kind comment by Elin Waring in the BTS, I have now revisited > my bug report, and discovered that the help page for data.class() claims > that its return value (the first element of the class attribute vector) is > "what is typically useful for method dispatching". > > However, I think that this use case illustrates that it would be useful not > only to check for the primary class, but rather for class inheritance. > > Do you agree that it is preferable for the S3 method to check for > inheritance instead of checking against a hardcoded list in this case? > > Kind regards, > > Johannes Ranke > > > [1] https://github.com/jranke/mkin/blob/master/R/nlme.mmkin.R > [2] https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17761 > [3] https://bugs.r-project.org/bugzilla/attachment.cgi?id=2578 P.S.: I have updated the patch [4] based on comments provided by Sebastian Meyer. [4] https://bugs.r-project.org/bugzilla/attachment.cgi?id=2656 [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] nlme: New variance function structure varConstProp
Dear R developers, recently I have written a wishlist bug report for nlme containing a patch that adds the variance function structure s2(v) = t1^2 + t2^2*v^2 where v denotes the variance covariate, s2(v) denotes the variance function evaluated at v, and t, t1 and t2 are the variance function coefficients. The covariate can also be the fitted response. The idea that the residual variance has an additive component and a component proportional to the observed or fitted response is found in analytical chemistry [2, 3], pharmacokinetics [4], and has recently also been introduced to chemical degradation kinetics [5, 6]. As discussed in a recent monograph on mixed effects models [7, p. 55] and in a manuscript dedicated to the comparison of different variants of this error model [4], there are two principal possibilities to implement the idea of combining additive and proportional error. The variant implemented in the proposed patch assumes that the sources of the additive and the proportional component are independent. An alternative variant would be s2(v) = (t1 + t2*abs(v))^2 However, I have less frequently found that alternative proposal in the literature, and I also think that it makes sense to assume independent sources of the two components. I think that adding the possibility to specify this error model greatly enhances the potential of the nlme package in the area of generalised linear models (gls), generalised nonlinear models (gnls) and, last but not least, generalised nonlinear mixed effects models (nlme). In addition, the patch is rather unobtrusive, as it only adds a further variance function structure. The documentation contains an example application using gnls(), and there is a test using nlme() and group dependent values for t1 and t2. Therefore, I would recommend the proposed patch for your kind consideration. Johannes Ranke [1] https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17954 [2] https://doi.org/10.1093/clinchem/24.11.1895 [3] https://doi.org/10.1016/j.aca.2003.12.047 [4] https://doi.org/10.1016/j.ejps.2017.05.021 [5] https://doi.org/10.3390/environments6120124 [6] https://pkgdown.jrwb.de/mkin/dev/reference/sigma_twocomp.html [7] https://doi.org/10.1201/b17203 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] reverse dependency checks
Am Donnerstag, 18. Februar 2021, 19:58:09 CET schrieb Therneau, Terry M., Ph.D. via R-devel: > There are some nice tools to automate reverse dependency checks, but for a > large package the real issue is the envirionment. The description of the > crandalf site on github has a nice summary. One package uses a cryto > libraries (oops, install those), another uses some latex macros I've never > heard of, etc.In any case, I am seeing some failures in my reverse > checks for survival that I'm not sure how to fix. If anyone has a hint or > two I'd be grateful. > > 1. A half dozen fail with "graphics API mismatch" Such error messages could occur if visual diffs (of SVG plots) are run with R > 4.0 (i.e. R-devel) where the reference files were generated with R <= 4.0. This is described in https://github.com/r-lib/vdiffr/issues/86 However the vdiffr tests are only run if you set the NOT_CRAN environment variable, for example because you use devtools for running tests, see https://github.com/r-lib/vdiffr#testing-versus-monitoring Kind regards, Johannes > > 2. Over a dozen have a latex failure of > ! pdfTeX error (\pdfsetmatrix): Unrecognized format.. > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox >\fi \fi > > A check of kpsewhich shows I have all the packages, and I don't see a > pattern in the .tex files at the point of failure. > > Terry T. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] reverse dependency checks
Am Donnerstag, 18. Februar 2021, 22:36:38 CET schrieb Johannes Ranke: > Am Donnerstag, 18. Februar 2021, 19:58:09 CET schrieb Therneau, Terry M., > ... > > checks for survival that I'm not sure how to fix. If anyone has a hint > > or two I'd be grateful. > > > > 1. A half dozen fail with "graphics API mismatch" > > Such error messages could occur if visual diffs (of SVG plots) are run I was not thinking clearly enought yesterday night (I hope I am this morning...). These error message you are known to occur if a graphics package such as svglite [1] has to be reinstalled. The error message has also been associated [2] to the issue I was referring to, but I am not sure this is correct. Johannes [1] https://github.com/r-lib/svglite/issues/71 [2] https://github.com/r-lib/vdiffr/issues/103 > with > R > 4.0 (i.e. R-devel) where the reference files were generated with R <= > 4.0. This is described in > > https://github.com/r-lib/vdiffr/issues/86 > > However the vdiffr tests are only run if you set the NOT_CRAN environment > variable, for example because you use devtools for running tests, see > > https://github.com/r-lib/vdiffr#testing-versus-monitoring > > Kind regards, > > Johannes > > > 2. Over a dozen have a latex failure of > > ! pdfTeX error (\pdfsetmatrix): Unrecognized format.. > > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox > > > >\fi \fi > > > > A check of kpsewhich shows I have all the packages, and I don't see a > > pattern in the .tex files at the point of failure. > > > > Terry T. > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Johannes Ranke Wissenschaftlicher Berater 07624 8099027 https://jrwb.de [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] S3 dispatch does not work for generics defined inside an environment
> In the end, I wrote a package that implements lightweight python-like > modules for R and that has really improved my workflow. I hope to publish > this package later this year after I have cleaned it up a bit. Hi, are you aware of the previous work in this direction https://github.com/klmr/box and https://github.com/wahani/modules Johannes [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] use Ctrl-W to close View() window?
Hi, am I missing something or could you just use Alt-F4? This is pretty standard for closing focussed windows on Windows and Linux at least. It just closed a Window opened with View() on Debian Linux FWIW. Cheers, Johannes Am Freitag, 17. März 2023, 23:16:49 CET schrieb Ben Bolker: >I might be the last person in the world who's using View() outside of > RStudio, but does anyone have a sense of how hard it would be to enable > closing such a window (when in focus) with a standard keyboard shortcut > (e.g. Ctrl-W on Linux) ... ? Where would I start looking in the code base? > >Or maybe this can already be enabled somehow? > >cheers > > Ben Bolker > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] download.file() yields incomplete files with method="internal"
Hi Jan! * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [060615 15:10]: > > Dear all, > > as the bug # 7991 is flagged not-reproducible, let me give you some pieces > of code, as I have the same or similar problem. The problem always shows up > with the first example (a small text file) and only sometimes (but without > obvious pattern) with the second example, which is a binary file. > > > download.file("ftp://ftp.nhc.noaa.gov/pub/atcf/btk/bal012006.dat";, > "C:/temp/bal012006.dat", method = 'internal', mode = 'w', cacheOK = FALSE) > trying URL 'ftp://ftp.nhc.noaa.gov/pub/atcf/btk/bal012006.dat' > ftp data connection made, file length 5110 bytes > opened URL > downloaded 0 bytes > > Warning message: > downloaded length 0 != reported length 5110 when I tried the first example (Windows NT, R 2.3.1), it worked correctly two times, and then gave exactly the error message you cited in the third run. The second example worked once, and then gave the behaviour cited by you, only the downloaded length differed. Specs: > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) > win.version() [1] "Windows NT 4.0 (build 1381) Service Pack 6" No problems on Linux, R 2.3.1 (after replacing "C:/temp" by /tmp/). Regards, Johannes > > > > download.file("ftp://ftp.nhc.noaa.gov/pub/atcf/aid_public/aal012006.dat.gz";, > "C:/temp/aal012006.dat.gz", method = 'internal', mode = 'wb', cacheOK = > FALSE) > trying URL 'ftp://ftp.nhc.noaa.gov/pub/atcf/aid_public/aal012006.dat.gz' > ftp data connection made, file length 173760 bytes > opened URL > downloaded 155Kb > > Warning message: > downloaded length 159140 != reported length 173760 > > > Finally, is the spec of the system I'm working on: > > version >_ > platform i386-pc-mingw32 > arch i386 > os mingw32 > system i386, mingw32 > status > major 2 > minor 3.1 > year 2006 > month 06 > day01 > svn rev38247 > language R > version.string Version 2.3.1 (2006-06-01) > > win.version() > [1] "Windows XP Professional (build 2600) Service Pack 2.0" > > > Many thanks in advance and best regards, > Jan > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Dr. Johannes Ranke [EMAIL PROTECTED] UFT Bremen, Leobenerstr. 1 +49 421 218 8971 D-28359 Bremen http://www.uft.uni-bremen.de/chemie/ranke __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel