@gaborcsardi@fosstodon.org
@gaborcsardi@fosstodon.org avatar

gaborcsardi

@gaborcsardi@fosstodon.org

Software Engineer at Posit PBC

This profile is from a federated server and may be incomplete. Browse more on the original instance.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

This is how httr2 and other packages use the base |> pipe in examples, and still support older R, including a clean R CMD check:
https://github.com/tidyverse/purrr/commit/426acdd50424b8cd6029d237c4d4e81d94ec42a6#diff-611496f412cac947be720d17a0ee6d7463221d14731fbc18244756271e8f5189

Ie. you need a configure (+ configure.win) file that creates an Rd macro on older R, that rewrites the examples with |>.
You'll also need Biarch: true in DESCRIPTION.

Clean R CMD check from R 3.6.x to R-4.4.x: https://github.com/r-lib/httr2/actions/runs/7548766508

gaborcsardi, (edited ) to random
@gaborcsardi@fosstodon.org avatar

How do you set your CRAN mirror and other repositories? If other, please reply to this post.

eamon, to random
@eamon@social.coop avatar

I have an {httr2} question: I'm about to make a bajillion requests to the same server. Can I use the server's keep-alive capability to batch these more efficiently? I'm not finding any info on this online or in the docs.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@eamon Hmmm, in that case I am afraid you'll need to use curl::multi_* directly.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@eamon see “Perform multiple requests” at https://httr2.r-lib.org/reference/index.html. If that’s not flexible enough, you can use the multi_* functions in curl.

quantixed, to random

is remotes::install_github() currently not working?
Getting HTTP error 401. Bad credentials.
Sys.getenv("GITHUB_PAT”) is empty and anyway, I’m just trying to install from a public repo.
Using R 4.4.0 & remotes_2.5.0 on macOS

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@quantixed Hard to know what is going wrong, but nevertheless I suggest you try pak instead: https://pak.r-lib.org/reference/install.html

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@quantixed you probably have an expired PAT in your git credential store. You can update it or delete it with the gitcreds R package.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

If you see warnings/errors on GitHub Actions related to Matrix incompatibilities for your R package, see this issue for possible workarounds:
https://github.com/r-lib/actions/issues/832

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

The new evercran project (https://github.com/r-hub/evercran#readme) helps you run old (or ancient) versions of R, together with old (or ancient) snapshots of CRAN.

jrosell, to random
@jrosell@mastodon.social avatar

.@gaborcsardi hi, what do you think is the recommended way to assert params in roxygen2 now that argufy is "read only"? https://github.com/gaborcsardi/argufy

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@jrosell IDK if there is a way via roxygen2, but personally I use assertthat or some lighter version of it embedded into the package. rlang also has a file that you can copy into your package: https://github.com/r-lib/rlang/blob/main/R/standalone-types-check.R

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@jrosell Well, unfortunately that's a dead project right now. R packages do not really have a standard code generation workflow, so this is a pretty hard problem.

_wurli, to random

Bizarre discovery of the week: control-flow statements don't necessarily have to be within a set of braces, unless the code it at the 'top level'. Super weird.

https://github.com/r-lib/tree-sitter-r/issues/103#issuecomment-2088580114

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_wurli That's not entirely true.

for (i in 1:5)
print(i)

and

if (TRUE)
"foobar"

etc. are fine.

if (TRUE) "foo" else "bar"

etc. is also fine.

Basically, if the parser has a complete expression after reading a line, it evaluates it.

This usually works out fine, and does what you'd expect.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_wurli https://cran.r-project.org/doc/manuals/r-release/R-lang.html#if-1

"When the if statement is not in a block the else, if present, must appear on the same line as the end of statement2. Otherwise the new line at the end of statement2 completes the if and yields a syntactically complete statement that is evaluated."

lars_dalby, to rstats

Hmm, I'm having trouble connecting to the @Posit package manager at the moment. I get:
Warning: unable to access index for repository <https://packagemanager.posit.co/cran/latest/src/contrib>: cannot open URL '<https://packagemanager.posit.co/cran/latest/src/contrib/PACKAGES'> Is anyone else in the community seeing this? @rstats

gaborcsardi,
@gaborcsardi@fosstodon.org avatar
zsmith27, to random

I have a private GitHub repo for an R package I developed for my organization. I cannot deploy a pkgdown webpage for my team in a private repo. Does anyone know if I can easily include a pkgdown webpage within my package (maybe in inst?) and have users serve it locally with a function call? I just saw this post from Maëlle Salmon: https://mastodon.social/@maelle/112393952364276977. Maybe servr::httw() could facilitate this?

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@zsmith27 I don't think you need a web server for this. Put the web site in inst, and then open the index.html file from the disk. E.g.

utils::browseURL(system.file(
package = "...",
"inst/docs/index.html"
))

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

PSA: if you get GitHub Actions failures because of the Matrix binary incompatibility issue, this is a possible workaround: https://github.com/gmonette/cv/compare/main...gaborcsardi:cv:main
You may also put a thumbs up on this issue: https://github.com/r-lib/actions/issues/780 to help me access the impact of this. Thanks!

jmcastagnetto, to random
@jmcastagnetto@mastodon.social avatar

@coolbutuseless -- just saw this on the incognito site :-)

https://x.com/JosiahParry/status/1787871177677115698

{yyjsonr} rewlz in speed and size

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@jmcastagnetto jsonlite being extremely slow is also just not true:

❯ system.time(x1 <- jsonlite::fromJSON("./biocatgh/cran-full.json", simplifyVector=FALSE))
user system elapsed
2.046 0.245 2.349

❯ system.time(x2 <- yyjsonr::read_json_file("./biocatgh/cran-full.json"))
user system elapsed
0.910 0.095 1.026

❯ system.time(x3 <- jsonify::from_json("./biocatgh/cran-full.json"))
user system elapsed
2.124 0.108 2.248

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@jmcastagnetto Those numbers seem wrong:

❯ du -hs /Users/gaborcsardi/Library/R/arm64/4.4/library/rapidjsonr
780K

❯ du -hs /Users/gaborcsardi/Library/R/arm64/4.4/library/yyjsonr
2.9M

cedricr, to random
@cedricr@mapstodon.space avatar

PSA for users: consider adding sth like
1 options(Ncpus = parallel::detectCores() - 2) and

2 Sys.setenv(MAKEFLAGS = paste0("-j", max(parallel::detectCores() - 2, 1))) in your .Rprofile.

1 will make packages install in //, 2 will make builds from source parallelized.

On a 32 cores box, building @tylermorganwall rayshader (many dependencies):
none: 718s
2: 327s
1+2 : 138s

duckdb (no dep):
none: 989s
2: 112s

Prepare for some fan noise though !

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@cedricr If you do 1) do you know what's the best way to tell which packages succeeded to install, and which failed?

lwpembleton, to random
@lwpembleton@genomic.social avatar

Does anyone know if this is an error on ? I went to install the {multcompView} package only to have the error returned:
package ‘multicompView’ is not available for this version of R
So I naturally checked on CRAN what version of R it Depends on, and to my suprise, nothing was listed 🤔 I would have thought listing the R version under Depends would be a hard requirement and would have failed CRAN checks otherwise.

https://cran.r-project.org/web/packages/multcompView/index.html

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@lwpembleton The latest version also works on R 4.3.3 for me.

You can get this error for a network error, or if a dependency requires a later versions of R.

You can try
pak::pkg_install("multcompViev")
and if it does not work, pak might tell you why exactly.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

R-hub v2 is here!

It is a completely new system, better and faster! See the details in the blog post: https://blog.r-hub.io/2024/04/11/rhub2/

@RConsortium

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Has anyone ever written a "multi-facetted" package for CRAN?

For example, I have a package that uses the connections API.

I would like the full version available from GitHub and r-universe.

Through clever use of defines and 'if' statements etc, the CRAN version would exclude all forbidden code.

Could this exist in one pkg tarball? Or would the tarballs have to be different?

Are there CRAN-specific ENV vars that can be used to control the inclusion/exclusion of code?

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coolbutuseless You can create another package for the extra features, and keep that on GitHub.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

R 4.4.0 is coming in less than one month!

With rig you can try the first alpha easily while keeping your current R version. Run

rig add next

to install, and then

R-next

to start R 4.4.0 alpha.

On Windows, macOS or one of the many supported Linux distributions.

See https://github.com/r-lib/rig#readme

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

pak 0.6.0 blog post about the new (more) automatic system requirements installation: https://www.tidyverse.org/blog/2023/09/pak-0-6-0/

Change log:
https://github.com/r-lib/pak/releases/tag/v0.6.0

Installation:
https://pak.r-lib.org/reference/install.html

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

If you want to try the new R 4.3.3 release without upgrading, try https://github.com/r-lib/rig#readme

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

We added four new containers to R-hub recently:

  • gcc14
  • c23
  • clang19
  • rchk

https://github.com/r-hub/rhub
https://github.com/r-hub/containers

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • mdbf
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • DreamBathrooms
  • megavids
  • GTA5RPClips
  • tacticalgear
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • ethstaker
  • anitta
  • provamag3
  • Leos
  • cisconetworking
  • lostlight
  • All magazines