Articles by Jonathan Carroll

Now You’re Thinking with Arrays

August 28, 2023 | Jonathan Carroll

I keep hearing the assertion that “writing APL/Haskell/etc… makes you think differently” and I kept wondering why I agreed with the statement but at the same time didn’t think too much of it. I believe I’ve figured out that it’s because I happened to h...
[Read more...]

Taking from Infinite Sequences

August 17, 2023 | Jonathan Carroll

One thing that has really caught my attention as I learn more programming languages is the idea of generators or infinite sequences of values. Yes, infinite. Coming from R, that seems unlikely, but in at least several other languages, it’s entirely pos...
[Read more...]

Pythagorean Triples with Comprehensions

August 12, 2023 | Jonathan Carroll

I’ve been learning at least one new programming language per month through Exercism and the #12in23 challenge. I’ve keep saying, every time you learn a new language, you learn something about all the others you know. Plus, once you know \(N\) languages, the \(N+1^{\rm th}\) is significantly ...
[Read more...]

Wrapping C Code in an R Package

August 10, 2023 | Jonathan Carroll

Your collaborator says to you “I have some code I’d like to distribute to people who will probably work in R most of the time. I don’t write R, but I write C. Can you package this up for me?” so you have a few options: re-write the ...
[Read more...]

Argument Matching Across Languages

August 5, 2023 | Jonathan Carroll

With Functional Programming, we write functions which take arguments and do something with or based on those arguments. You might not think there’s much to learn about given that tiny description of “an argument to a function” but the syntax and mechanics of different languages is actually widely variable ... [Read more...]

Array Languages: R vs APL

July 6, 2023 | Jonathan Carroll

I’ve been learning at least one new programming language a month through Exercism which has been really fun and interesting. I frequently say that “every language you learn teaches you something about all the others you know” and with nearly a dozen under my belt so far I’m ...
[Read more...]

Reflecting on Macros

June 9, 2023 | Jonathan Carroll

I’ve been following the drama of the RustConf Keynote Fiasco (RKNF, per @fasterthanlime) from a great distance - I’m not involved in that community beyond starting to learn the language. But the controversial topic itself Compile-Time Reflection seemed like something interesting I could learn something about. A good ...
[Read more...]

Which Plot Was That?

May 25, 2023 | Jonathan Carroll

Plotly has a nice way of making click-events available to the calling language, but it doesn’t quite work simply when using subplot(). This isn’t a post about a new feature, but I didn’t quickly find a resource for it so I’ll add my findings to make ...
[Read more...]

Polyglot Exploration of Function Overloading

April 2, 2023 | Jonathan Carroll

I’ve been working my way through Exercism exercises in a variety of languages because I strongly believe every language you learn something about teaches you about all the others you know, and makes for useful comparisons between what features they offer. I was1 Learning Me a Haskell for Great ... [Read more...]

Polyglot Sorting

October 7, 2022 | Jonathan Carroll

I’ve had the impression lately that everyone is learning Rust and there’s plenty of great material out there to make that easier. {gifski} is perhaps the most well-known example of an R package wrapping a Rust Cargo crate. I don’t really know any system language particularly well, ...
[Read more...]

Where for (loop) ARt Thou?

April 21, 2022 | Jonathan Carroll

I’ve long been interested in exactly how R works - not quite enough for me to learn all the internals, but I was surprised that I could not find a clear guide towards exactly how vectorization works at the deepest level. Let’s say we want to add two ... [Read more...]

Codegolfing Minecraft Lighting

March 25, 2022 | Jonathan Carroll

I occasionally like to participate in an odd sport known as ‘code golf’ where the aim is to write some code to achieve a given task using the smallest number of characters. The tradtional way to cheat at golf is to lower your score R isn’t optimised...
[Read more...]

Adventures in x86 ASM with rx86

December 22, 2021 | Jonathan Carroll

I just finished ‘Code: The Hidden Language of Computer Hardware and Software’ by Charles Petzold which was a really well-written (in my opinion) guided journey from flashing a light in morse code through to building a whole computer, and everything needed along the way. The section on encoding instructions for ...
[Read more...]

Improving a Visualization

July 1, 2021 | Jonathan Carroll

I saw this post on Reddit’s r/dataisbeautiful showing this plot of streaming services market share, comparing 2020 to 2021 US Streaming Services Market Share, 2020 vs 2021 and thought it looked like a good candidate for trying out some plot improvem...
[Read more...]

isEven without modulo

March 8, 2020 | Jonathan Carroll

You may have seen the memes going around about fun ways to program the straightforward function isEven() which returns TRUE if the input is even, and FALSE otherwise. I had a play with this and it turned into enough for a blog post, and a nice walk through some features ... [Read more...]

{ggtext} for images as x-axis labels

August 12, 2019 | Jonathan Carroll

I’ve written a few times about using an image as an x-axis label, and the solutions have been slowly improving. This one blows all of them out of the water. Claus Wilke (@ClausWilke) now has a {ggtext} package which can very neatly add images as x-axis labels! This makes ...
[Read more...]

forcats::fct_match

February 22, 2019 | Jonathan Carroll

This journey started almost exactly a year ago, but it’s finally been sufficiently worked through and merged! Yay, I’ve officially contributed to the tidyverse (minor as it may be). I’m at least as useful as Zoidberg It began with a tweet, recalling a surprise I encountered that ...
[Read more...]

forcats::fct_match

February 22, 2019 | Jonathan Carroll

This journey started almost exactly a year ago, but it’s finally been sufficiently worked through and merged! Yay, I’ve officially contributed to the tidyverse (minor as it may be). It began with a tweet, recalling a surprise I encountered that...Continue Reading →
[Read more...]
1 2 3 4

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)