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

mdsumner, to random
@mdsumner@rstats.me avatar

CRAN is down, don't know that I've ever seen that before

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@mdsumner DNS issue, use the cran.rstudio.com mirror

sckottie, to random
@sckottie@fosstodon.org avatar

All cran mirrors down?

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@scheidegger @sckottie Use the https://cran.rstudio.com mirror, that's the same, with a different name.

gaborcsardi, to random
@gaborcsardi@fosstodon.org avatar

It uses the same tables as https://github.com/patperry/utf8lite which has scripts to update

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.

kirill, to random

I recently read Nikita Prokopov’s fantastic blog post on Unicode: https://tonsky.me/blog/unicode/. I think I now understand graphemes (=extended grapheme clusters). The text referred to 🤦🏼‍♂ as an example that many systems get wrong, I was wondering about the case of . Turns out it's not that bad with a proper library 📚.

https://gist.github.com/krlmlr/0abe8059d99427838aee06c540bc54c5

I now wonder if the utf8 package needs a way to compute the number of graphemes in a string, as a lighter-weight alternative to stringi.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@kirill FWIW the cli package supports graphemes properly, in all functions, e.g.

❯ cli::utf8_nchar(my_facepalm)
[1] 1

Also unicode width:

❯ cli::utf8_nchar(my_facepalm, type = "width")
[1] 2

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@kirill It uses (some) Unicode tables from https://github.com/patperry/utf8lite, which has scripts to update.

josi, to random
@josi@fosstodon.org avatar

Before I go building it...is anyone aware of an package that can build a pkgdown site's infrastructure as markdown? I don't want the html. I want the markdown.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@josi you would need to translate Rd files to markdown if you want markdown without any html… which seems hard…

brodriguesco, to random
@brodriguesco@fosstodon.org avatar

Is it possible to run a pre-defined github action in a arbitrary shell?
Something like this doesn’t seem to work:

  • name: Publish to GitHub Pages (and render)
    uses: quarto-dev/quarto-actions/publish@v2
    with:
    target: gh-pages
    env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    shell: nix-shell --command "bash" {0}

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

@brodriguesco You'll probably need to fork that action then, and add custom shells to each step, if it is a composite action.

terence, to random
@terence@fosstodon.org avatar

Spent the last few days trying to write a Perlin noise generator in only to discover that it's already in the {ambient} package. 🤦‍♂️

At least I learned the maths behind it, for what that's worth.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@joe_chelladurai @adrianco @terence

❯ pkgsearch::pkg_search("Perlin noise generator")

  • "Perlin noise generator" ------------------- 3410 packages in 0.026 seconds -

package version by @ title

1 100 ambient 1.0.2 Thomas Lin Pedersen 1y A Generator of Multidime...
2 32 knitr 1.44 Yihui Xie 1M A General-Purpose Packag...

josi, to random
@josi@fosstodon.org avatar

Tips on using {usethis} without PAT? I use an ssh key and don't want to store a PAT as an env variables.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@josi A PAT is better than an ssh key in terms of security, for a number of reasons, and for GH you can create one that does not expire. You also do not need to store it in an environment variable. usethis will use the git credential store to find it. You cannot use the GH API without a a PAT, so there there is no way that usethis could help you with that.

vitaly_druker, to random
@vitaly_druker@fosstodon.org avatar

I'm totally lost in the deparse/substitute hell with the following problem. I'm trying to wrap a function from a pkg (pkg_func below) but it keeps erroring out because of the way it checks its inputs - it doesn't allow you to use a variable. Does anyone know what magic I need to do in my_func to make it work? Code is available in alternate text of image.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@vitaly_druker pkg_func() has a pretty terrible API: it takes a function and it checks the variable name that was used to pass that function in.

I suggest you design a different API for your function, e.g. take a string as an argument instead, if the function is only supposed to work with a handful of functions.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@vitaly_druker E.g.

my_func <- function(which = c("survdiff", "cosph", "survreg")) {
which <- match.arg(which)
switch(
which,
"survdiff" = {
survdiff <- survival::survdiff
pkg_func(survdiff)
},
"coxph" = {
TODO
},
"survreg" = {
TODO
}
)
}

jonocarroll, to random
@jonocarroll@fosstodon.org avatar

Question for the hivemind:

My understanding was that R does string interning, but I (randomly) wanted to see it in action and couldn't observe such behaviour in a trivial example. If I run

x <- "uniquestring"
y <- "uniquestring"
print(pryr::address(x))
print(pryr::address(y))

in a non-interactive script I get two different addresses. ChatGPT seems to think this should produce the same address...

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@yjunechoe @jonocarroll This is not so much about vectorization, but rather the global string cache. R stores every string at most once, in a global cache, and CHARSXP objects point to entries in this cache. See https://cran.r-project.org/doc/manuals/r-release/R-ints.html#The-CHARSXP-cache

Re vectorization, yes, a character() in R is a STRSXP, which is a vector of CHARSXPs.

necrosis, to openSUSE German
@necrosis@chaos.social avatar

Help. How can I install on ?

How can I install libicui18n.so.58?

It seems this package is needed.
My OS is

libxml2-devel is installed but it fails anyway. 😕

Screenshot Terminal libxml2 is installed.
Screenshot of terminal.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@necrosis conda R and non-conda R don't work together well. Either use conda and install packages within conda R. Or you'll need to deactivate conda to use non-conda R.

ikosmidis, to random

do you have any suggestions on how the below works in R version 4.3.1 and why?
😖

&gt; "zero" &gt; Inf  
[1] TRUE

&gt; "zero" &lt; Inf  
[1] FALSE

&gt; "zero" &gt; -Inf  
[1] TRUE

&gt; "zero" &lt; -Inf  
[1] FALSE

&gt; "zero" &gt; .Machine$double.xmax  
[1] TRUE

&gt; "zero" &lt; .Machine$double.xmax  
[1] FALSE

&gt; "zero" == 0  
[1] FALSE

&gt; "zero" &gt; 0  
[1] TRUE

&gt; "zero" &lt; 0  
[1] FALSE  

A character string seems to be larger than any floating point number, even Inf...

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@ikosmidis The RHS is converted to character using as.character() and the order is lexicographic:

❯ "zero" > Inf
[1] TRUE

❯ "azero" > Inf
[1] FALSE

See ?">"

MikeMahoney218, to random
@MikeMahoney218@fosstodon.org avatar

One Weird Trick to get the monthly sum of downloads for each package from the RStudio CRAN mirror

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@MikeMahoney218 Or, you can avoid downloading a GB of csv files, and use the cranlogs package (or the JSON API it uses directly) to query the packages you are interested in:
https://github.com/r-hub/cranlogs#readme
https://github.com/r-hub/cranlogs.app#readme

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@MikeMahoney218 It is in HOST/monthly-totals

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

TIL: someone once attempted refactoring R from C to C++

Project name: CXXR

https://www.cs.kent.ac.uk/projects/cxxr/

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

Anyone know how to get a list of functions callable via ".Internal()"?

Or to I have to go to the R source code?

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

Today I am pleased to annouce the c64-verse!

I trio of packages for c64 development in

  1. {c64vice} talks to a running VICE c64 emulator to send/receive info, cpu registers, memory dumps etc

  2. {c64asm} is a revamp of {r64}, a pure-R assembler for c64 6502 machine code - including syntax for including R data into code

  3. {c64tass} a wrapper for TASS - the de factor standard in c64 assemblers.

Logo for c64tass package. A hexagon with a Commodore computing logo in the centre.
Logo for c64asm package. A hexagon with a Commodore computing logo in the centre.
Logo for c64vice package. A hexagon with a Commodore computing logo in the centre.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coolbutuseless Time to dust off my 5 1/4" floppy disks :D

klmr, to random
@klmr@mastodon.social avatar

WTF of the day:

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@klmr

Yeah, you can have a string literal on the LHS, to assign values to non-syntactic names, I think that's from before we had backticks.

How the symbol name changes to NA is more surprising to me, maybe this is a bug:
❯ as.symbol(NA_character_)
NA

I think R should just not allow an NA string literal on the LHS of an assignment. It should probably be an error.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@klmr I have some vague memories that base R replaced the string literal symbols with backticks a long time ago,.

IDK if CRAN ever looked at the amount of breakage it would cause to make this an error.

coreysparks1, to random

Hey crowd, I’m building a small package for some convenience functions for my company, and all the devtools package tests fail because I don’t have any tests built into the package, I have no intention on putting this on cran, so should I care? My IT folks say we can use it if it meets CRAN requirements, but it’s failing the tests.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coreysparks1 I am pretty sure that devtools::check() does not fail if you don't have tests, so if it does for you, please submit an issue.

gaborcsardi,
@gaborcsardi@fosstodon.org avatar

@coreysparks1 Or if you meant devtools::test() failing, then call these

usethis::use_testthat()
usethis::use_test("foo")

to add some dummy tests, if you are not ready to add real test cases just yet.

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