Hadley Wickham
2025-Mar-05 13:47 UTC
[Rd] Depends: R (>= 4.1) for packages that use |> and \(...)
Unfortunately your test generates a false positive for httr2 ( https://cran.r-project.org/web/checks/check_results_httr2.html) and other tidyverse packages where we use the base pipe in examples, but carefully disable them for older versions of R. Hadley On Thu, Feb 6, 2025 at 9:18?AM Ivan Krylov via R-devel < r-devel at r-project.org> wrote:> On Thu, 23 Jan 2025 11:16:48 +0100 > Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote: > > > My guess would be that the new syntax is particularly prominently used > > in examples: if so, it would be good to also have coverage for this. > > In today's CRAN snapshot, there turned out to be 198 packages that use > 4.1 syntax in examples but not in code, 5 packages that use 4.2 syntax > in examples but 4.1 in the code, and 3 packages that use 4.2 syntax in > examples but not the code. This may be slightly imprecise because I > don't have some of the Rd macro packages installed and run > Rd2ex(stages=NULL) on manually-parsed Rd files without installing the > packages. > > Attaching a patch that checks the syntax used in Rd examples at the > same time as the main R code, not necessarily the best way to perform > this check. Is it perhaps worth separating R/* checks from man/*.Rd > checks? Should R CMD check try to reuse the Rd database from the > installed copy of the package? > > -- > Best regards, > Ivan > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- http://hadley.nz [[alternative HTML version deleted]]
Serguei Sokol
2025-Mar-05 14:03 UTC
[Rd] Depends: R (>= 4.1) for packages that use |> and \(...)
Le 05/03/2025 ? 14:47, Hadley Wickham a ?crit?:> Unfortunately your test generates a false positive for httr2 ( > https://cran.r-project.org/web/checks/check_results_httr2.html) and other > tidyverse packages where we use the base pipe in examples, but carefully > disable them for older versions of R.For exemple,? in one of reported files 'iterate_with_offset.Rd' ( https://github.com/r-lib/httr2/blob/main/man/iterate_with_offset.Rd ), we can see : \examples{ req <- request(example_url()) |> ? req_url_path("/iris") |> ? req_throttle(10) |> ? req_url_query(limit = 50) ... the pipe '|>' is well used but I didn't find any check for R version prior to 4.1. May be it is done elsewhere? Best, Serguei.> > Hadley > > On Thu, Feb 6, 2025 at 9:18?AM Ivan Krylov via R-devel < > r-devel at r-project.org> wrote: > >> On Thu, 23 Jan 2025 11:16:48 +0100 >> Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote: >> >>> My guess would be that the new syntax is particularly prominently used >>> in examples: if so, it would be good to also have coverage for this. >> In today's CRAN snapshot, there turned out to be 198 packages that use >> 4.1 syntax in examples but not in code, 5 packages that use 4.2 syntax >> in examples but 4.1 in the code, and 3 packages that use 4.2 syntax in >> examples but not the code. This may be slightly imprecise because I >> don't have some of the Rd macro packages installed and run >> Rd2ex(stages=NULL) on manually-parsed Rd files without installing the >> packages. >> >> Attaching a patch that checks the syntax used in Rd examples at the >> same time as the main R code, not necessarily the best way to perform >> this check. Is it perhaps worth separating R/* checks from man/*.Rd >> checks? Should R CMD check try to reuse the Rd database from the >> installed copy of the package? >> >> -- >> Best regards, >> Ivan >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >-- Serguei Sokol Ingenieur de recherche INRAE Cellule Math?matiques TBI, INSA/INRAE UMR 792, INSA/CNRS UMR 5504 135 Avenue de Rangueil 31077 Toulouse Cedex 04 tel: +33 5 61 55 98 49 email: sokol at insa-toulouse.fr https://www.toulouse-biotechnology-institute.fr/en/plateformes-plateaux/cellule-mathematiques/
Ivan Krylov
2025-Mar-05 15:49 UTC
[Rd] Depends: R (>= 4.1) for packages that use |> and \(...)
? Wed, 5 Mar 2025 07:47:04 -0600 Hadley Wickham <h.wickham at gmail.com> ?????:> Unfortunately your test generates a false positive for httr2 ( > https://cran.r-project.org/web/checks/check_results_httr2.html) and > other tidyverse packages where we use the base pipe in examples, but > carefully disable them for older versions of R.Please accept my apologies. Indeed, the script [1] called at configuration time does replace the examples section to avoid parse errors for example(...). And having example() do nothing (with all code and an explanation in the help page) is a small cost for having the rest of the package work on R versions as old as 3.5. I don't see a way to take this into account, since the workaround is completely invisible to sufficiently new versions of R. It might be that the best way forward is to revert the Rd example check. -- Best regards, Ivan [1] https://github.com/r-lib/httr2/blob/main/tools/examples.R