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

cedricr, to random
@cedricr@mapstodon.space avatar

PSA for #RStats 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?
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?

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

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?

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

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

_wurli, to random
@_wurli@fosstodon.org avatar

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
@lars_dalby@mstdn.social avatar

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?

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

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

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

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?

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

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.

_TimTaylor, to random
@_TimTaylor@fosstodon.org avatar

Tomas Kalibera has shared a new post on R on 64-bit arm windows. Not sure if there’s a bot sharing the R Project blog so sorry if I missed it. https://blog.r-project.org/2024/04/23/r-on-64-bit-arm-windows/index.html

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@_TimTaylor Arm Windows, the new Solaris of CRAN, yay! :D

yutannihilation, to random
@yutannihilation@fosstodon.org avatar

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

@MikeMahoney218 @coolbutuseless @yutannihilation NOTEs can definitely trigger emails from CRAN, and also package archivals from CRAN, this happens all the time. (In fact CRAN might request an update even if your package check is clean.)

OTOH there is nothing to do until they do email you, sometimes they change their minds, or sometimes they only enforce new rules for new submissions.

For the case at hand my guess is that they will enforce it, and I am updating my packages. Only a guess...

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.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

A handy thing about having a local CRAN mirror is that I can zgrep across the repository looking for code examples :)

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coolbutuseless For the rest of us there is a CRAN code mirror at https://github.com/cran :D

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • tsrsr
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • hgfsjryuu7
  • Youngstown
  • InstantRegret
  • slotface
  • khanakhh
  • rosin
  • ngwrru68w68
  • kavyap
  • PowerRangers
  • normalnudes
  • tacticalgear
  • cubers
  • everett
  • vwfavf
  • ethstaker
  • osvaldo12
  • Durango
  • mdbf
  • cisconetworking
  • modclub
  • GTA5RPClips
  • tester
  • anitta
  • All magazines