@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.

eamon, to random
@eamon@social.coop avatar

I have an #RStats {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 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.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

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

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
#rstats

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?

quantixed, to random
@quantixed@fosstodon.org avatar

is remotes::install_github() currently not working? #RStats
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.

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?
#rstats

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"
))

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

#RStats #json

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

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

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.

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?

#RStats

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

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

_wurli, to random

Bizarre #RStats 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
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.

brodriguesco, to random
@brodriguesco@fosstodon.org avatar

A vulnerability in has been discovered https://nvd.nist.gov/vuln/detail/CVE-2024-27322

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_TimTaylor @brodriguesco The supply chain attack part is bogus, because a package can also have an .onLoad() function, or a library init hook in C, so package authors can still run code on your machine, when you load their package.

Running code when loading an RDS is bad, OTOH.

brodriguesco, to random
@brodriguesco@fosstodon.org avatar

why are there two versions of MASS on src/contrib of CRAN? #RStats

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

@brodriguesco It is actually a good thing. This way old metadata that refers to the older version of the package still works. They would ideally keep the older files around for a couple of days.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

#RStats Help needed!

I want to email R-devel & get clarification on "Can we create custom connections in packages?"

I find the situation confusing because using the "Connections.h" is mentioned in R-exts manual - and so formally(?) part of the API

But this conflicts with the NOTE generated if you try to use "R_new_custom_connection()" which says it is "non-API"

Am I tilting at windmills? Poking the bear? HELP!

Edits/suggestions welcomed in the gist below.

https://gist.github.com/coolbutuseless/2b261e2f7f54206c1263fbca0e71ac64

#RStats

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@michaelchirico @coolbutuseless @jeroenooms Hah, I forgot archive used connections. pak embeds curl, but does not actually use the connection API.

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

#rstats

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_TimTaylor It does. The root of the problem is that CRAN currently has

Package: Matrix
Version: 1.6-5

but R 4.4.0 actually ships Matrix 1.7-0 which has breaking changes. PPM currently builds 1.6-5, because that's what's on CRAN, and builds all dependencies based on 1.6-5. But then these do not work with the pre-installed 1.7-0.

I would think that the shipped version of Matrix should be available on CRAN, e.g. for installations that do not have recommended packages. But that's not the case.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_TimTaylor I emailed R-devel.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Do any of the standard/extended checks on CRAN use *BSD?

#RStats

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

#RStats mood

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coolbutuseless I think that's actually fine? There is (de facto) only one implementation of R, and the released versions are not going to change any more. So it can only break on R-devel, which you'll notice because they will email you that your package is crashing.

yutannihilation, to random

Some days ago, the CRAN check with R-devel started to raise "Found non-API calls to R" NOTE. I'm not sure if they are serious on disallowing these not-so-minor APIs, but what should I do? Do you take some action or just wait?

For example, rlang package now has these NOTE:

File ‘rlang/libs/rlang.so’:
Found non-API calls to R: ‘R_ClosureExpr’, ‘R_PromiseExpr’,
‘SETLENGTH’, ‘SET_ENCLOS’, ‘SET_ENVFLAGS’, ‘SET_TRUELENGTH’

https://cran.r-project.org/web/checks/check_results_rlang.html

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@yutannihilation @MikeMahoney218 @coolbutuseless I think my packages will be fine, yes. There is now R_NewEnv, which helps me.

For other packages it will be tougher, e.g. cpp11 uses SET_TRUELENGTH() to manage vectors with pre-allocated storage. I don't think there is a workaround there. (Well, except for nasty ones.) So every package that uses cpp11 will have that NOTE.

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