Ben Harrap's Avatar

Ben Harrap

@bharrap.bsky.social

doer of data things at Yardhura Walani I do #rstats, surveys, biostatistics, #IDSov on Ngunnawal and Ngambri lands not Indigenous, non-binary (they/them) benharrap.com

2,058 Followers  |  822 Following  |  752 Posts  |  Joined: 05.09.2024  |  2.0705

Latest posts by bharrap.bsky.social on Bluesky

IPC scale to rank global food insecurity, includes five phases: 1. Minimal 2. Stress 3. Crisis 4. Urgence (Emergency) 5. Famine

For Gaza, 54.05% of its population, are in phase 4 (Urgence).

And 100% of the population is in phases 3 and above, meaning everyone needs urgent humanitarian assistance.

03.08.2025 19:38 β€” πŸ‘ 5    πŸ” 4    πŸ’¬ 2    πŸ“Œ 0
Preview
The Box-Cox power exponential distribution – Notes from a data witch This is so obviously a prequel post to something else that I want to write about GAMLSS models

I regret to inform you that she has, yet again, written more words than are necessary on a topic you don't care about

03.08.2025 02:02 β€” πŸ‘ 46    πŸ” 13    πŸ’¬ 2    πŸ“Œ 1
Preview
sidrar: An Interface to IBGE's SIDRA API Allows the user to connect with IBGE's (Instituto Brasileiro de Geografia e Estatistica, see &lt;<a href="https://www.ibge.gov.br/" target="_top">https://www.ibge.gov.br/</a>&gt; for more information)...

Brazil πŸ‡§πŸ‡· has a tremendous R community. Check out {sidrar} for the Instituto Brasileiro de Geografia e Estatistica (IBGE) and follow @viniciusoike.bsky.social (and while youβ€˜re at it, follow @beatrizgietner.bsky.social)!
#rstats #econsky #stats

cran.r-project.org/package=sidrar

01.08.2025 20:49 β€” πŸ‘ 3    πŸ” 3    πŸ’¬ 2    πŸ“Œ 0

Very disappointing that UseR continues to invite speakers affiliated with Russian state universities that openly support the Russian invasion of Ukraine. I expected better from the #RStats community...

02.08.2025 10:55 β€” πŸ‘ 28    πŸ” 4    πŸ’¬ 1    πŸ“Œ 1
Screenshot the New York Times Spelling Bee puzzle with the letter d-p-l-y-r typed above the 7-letter grid.

Screenshot the New York Times Spelling Bee puzzle with the letter d-p-l-y-r typed above the 7-letter grid.

It's not going to accept it, but in a good world, it would.

#dplyr #RStats

02.08.2025 18:28 β€” πŸ‘ 42    πŸ” 5    πŸ’¬ 1    πŸ“Œ 1
Post image Post image Post image

Join us on September 29th for amazing workshops followed by great talks on September 30th about new and classic #RStats packages, insightful use cases and discussions on how to to best communicate your results.

#DataScience #Statistics #Analytics

wombat2025.numbat.space

01.08.2025 05:45 β€” πŸ‘ 5    πŸ” 3    πŸ’¬ 0    πŸ“Œ 0

Irrespective of the legality, does nobody remember the fiasco that was My Health Record?

Or are we all resigned to the apparent fact that we have no control over our own data an more?

01.08.2025 10:16 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Join the runapp group! We're actually chatting right now

Message me?

01.08.2025 04:04 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

grand theft eigenvalue might be the best stats-pun username I've ever seen

31.07.2025 23:05 β€” πŸ‘ 2    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0
A response from the Claude LLM after being instructed to respond like an aggressive New Yorker:

Alright, alright, you want a function that strips ALL the whitespace, including those sneaky unicode characters? No problem, I got you covered.

Here ya go - this'll handle everything from your basic spaces to those weird unicode whitespace characters that like to hide in your data:

There ya have it! I gave you THREE versions because I'm thorough like that:

    Basic version - Uses \\s+ which catches 99% of whitespace including unicode. The perl = TRUE makes sure it handles unicode properly.
    Stringr version - Same thing but uses stringr if you're one of those tidyverse people.
    Comprehensive version - This bad boy explicitly targets specific unicode whitespace characters that sometimes slip through. I'm talking non-breaking spaces, em spaces, figure spaces - the whole gang.

The \\s+ pattern is your friend here - it matches ANY whitespace character (spaces, tabs, newlines, unicode whitespace) and the + means it'll grab consecutive whitespace characters all at once.

Just paste whichever version works for your situation and boom - no more whitespace problems. You need anything else or we good here?

A response from the Claude LLM after being instructed to respond like an aggressive New Yorker: Alright, alright, you want a function that strips ALL the whitespace, including those sneaky unicode characters? No problem, I got you covered. Here ya go - this'll handle everything from your basic spaces to those weird unicode whitespace characters that like to hide in your data: There ya have it! I gave you THREE versions because I'm thorough like that: Basic version - Uses \\s+ which catches 99% of whitespace including unicode. The perl = TRUE makes sure it handles unicode properly. Stringr version - Same thing but uses stringr if you're one of those tidyverse people. Comprehensive version - This bad boy explicitly targets specific unicode whitespace characters that sometimes slip through. I'm talking non-breaking spaces, em spaces, figure spaces - the whole gang. The \\s+ pattern is your friend here - it matches ANY whitespace character (spaces, tabs, newlines, unicode whitespace) and the + means it'll grab consecutive whitespace characters all at once. Just paste whichever version works for your situation and boom - no more whitespace problems. You need anything else or we good here?

lmao would recommend

31.07.2025 22:58 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Can you tell it to speak to you like an aggressive New Yorker instead?

31.07.2025 22:55 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Thanks for this thread, I wasn't aware of these issues! I've got some checking to do tomorrow of some Stata datasets I've made with haven 😬

31.07.2025 08:52 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Canada, France and the UK are set to recognise a Palestinian state.

Where is Australia?

30.07.2025 23:10 β€” πŸ‘ 34    πŸ” 6    πŸ’¬ 3    πŸ“Œ 0

WTF is wrong with the Northern Territory government!?

Reinstating the use of SPIT HOODS is utterly grotesque 🀬🀬🀬

30.07.2025 09:06 β€” πŸ‘ 16    πŸ” 8    πŸ’¬ 1    πŸ“Œ 0
Migrating from blogdown/Hugo to Quarto – Ben Harrap

I wrote a similar post a few months back, which might be helpful too!

benharrap.com/post/2024-11...

30.07.2025 09:28 β€” πŸ‘ 5    πŸ” 2    πŸ’¬ 1    πŸ“Œ 0
Preview
Read and write Stata DTA files β€” read_dta Currently haven can read and write logical, integer, numeric, character and factors. See labelled() for how labelled variables in Stata are handled in R. Character vectors will be stored as strL if an...

I'd be curious to see what happens with longer col names when using write_dta()

Does it just truncate?

haven.tidyverse.org/reference/re...

30.07.2025 09:17 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Wow it didn't take long

bsky.app/profile/bhar...

29.07.2025 07:43 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Aw nuts, well there's a new feature request then - disable functions from appearing in the outline!

28.07.2025 12:36 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
a young boy in a blue shirt is typing on a laptop computer . ALT: a young boy in a blue shirt is typing on a laptop computer .

What's the hackiest data thing you did recently?

I had to change the colour of some boxes in a SEM diagram but the code wouldn't run

So I opened the .svg file in a text editor and did find/replace for the RGB values instead

#rstats #databs

28.07.2025 09:41 β€” πŸ‘ 18    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

Why don't statisticians like getting feedback?

Because they spend all their time E[xΜ„]

#statssky

28.07.2025 09:00 β€” πŸ‘ 5    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0

Thanks Di, I've added them :)

@huizezhangsherry.bsky.social @weihaolipatrick.bsky.social
@jayanigamage.bsky.social if you prefer not to be on the list let me know!

28.07.2025 03:40 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I'm sure very few people actually care about this, it's just something I noticed having reformatted a bunch of code to be very explicit about what is what

28.07.2025 01:06 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
A shortcut I like to use is calling multiple geoms in an lapply() call, since this automatically generates a list. Works well for investigating plotting variations, e.g.

ggplot(diamonds, aes(carat)) +
  lapply(c(50,200), function(b) geom_histogram(bins=b, alpha=0.3))

A shortcut I like to use is calling multiple geoms in an lapply() call, since this automatically generates a list. Works well for investigating plotting variations, e.g. ggplot(diamonds, aes(carat)) + lapply(c(50,200), function(b) geom_histogram(bins=b, alpha=0.3))

ggplot(diamonds, aes(carat)) +
  lapply(
    X = c(50, 200), 
    FUN = function(b) geom_histogram(bins = b, alpha = 0.3)
  )

ggplot(diamonds, aes(carat)) + lapply( X = c(50, 200), FUN = function(b) geom_histogram(bins = b, alpha = 0.3) )

However, @gmcd.bsky.social's original post contains a genius idea! πŸ’‘Use lapply() to plot histograms with different bin sizes on top of each other!
#rstats #econsky #dataviz
Code in ALT

27.07.2025 23:29 β€” πŸ‘ 14    πŸ” 3    πŸ’¬ 4    πŸ“Œ 0

It's been a while since I last shared my starter pack

If you're a stats/data person in or from the Pacific region (not just Australia or Aotearoa) and would like to be included, please let me know!

#statssky #episky #databs #rstats #python

27.07.2025 23:12 β€” πŸ‘ 23    πŸ” 11    πŸ’¬ 8    πŸ“Œ 0

As an aside, it would be a nice QOL feature for {tidyverse} functions if the function arguments had the same name:

purrr::map(.x, .f)
dplyr::across(.cols, .fns)
dplyr::rename_with(.fn, .cols)

Maybe there's a reason I'm missing though #rstats

27.07.2025 23:06 β€” πŸ‘ 6    πŸ” 2    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

Sure, see the video

I've realised that it isn't the curly braces alone that cause the anonymous function to appear in the bookmarks - it only appears when the .fns argument is named (same for `.f =` in `map` and `.fn = ` in `rename_with`)

27.07.2025 22:53 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 1

Share your coding dreams!
I used to have nightmares where I was in the center of a dark, scary forest, and I had to code to escape, each coding success taking me closer to the edge and freedom. If I had an error, I'd appear back at the center and have to start over. I never got out. #rstats #databs

27.07.2025 02:16 β€” πŸ‘ 25    πŸ” 3    πŸ’¬ 6    πŸ“Œ 2

If the crime involves chaos and destruction of any kind, sulfur-crested cockatoos would need no convincing

27.07.2025 02:03 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I wonder if there's an option to exclude functions from the bookmarks though, that'd be another option

27.07.2025 01:30 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I've also been meaning to rave about air!

I started using it last week in RStudio and it is excellent, would highly recommend #rstats

My only gripe the insistence of adding curly brackets to anonymous functions and clogging up my bookmarks. It's probably just a setting I need to change!

26.07.2025 23:06 β€” πŸ‘ 10    πŸ” 3    πŸ’¬ 3    πŸ“Œ 0

@bharrap is following 20 prominent accounts