Profile avatar
pinkmongoose.bsky.social
Academic in blue food/ecology. Amateur musician, grow veg, do web nerdery, hills, and lift heavy things. I crochet a mean doiley. University of Stirling but from Lincolnshire. Thoughts dependent on environment and social structures around me.
152 posts 90 followers 213 following
Regular Contributor
Active Commenter

Darren's R Top Tips! R Packages exist which work with Javascript. A problem I ran into a while back, unexpectedly, was that R colour names are not ALWAYS the same as the same colour name in the web colour list. "Green" is an example, being #008000 on the web, and #00ff00 in R.

Darren's R Top Tips! Confused by hexadecimal colours such as "#80c0c0" in R? These hex codes are divided into three two-digit hexademical numbers, representing red, green, and blue like "#RRGGBB". So for each channel, 00 is the darkest and FF is the brightest.

So how much extra productivity do you think Thames Water will muster out its workforce? Debt per employee comes out about £2.4m according to the BBC. And their shares count for about 2% of the USS's investments, le sigh academique...

Darren's R Top Tips! If six digit colour hex codes are confusing and overly precise, consider using a triplet "#RGB" which is equivalent to "#RRGGBB". So for example "#FF0", "#0FF", and "#F0F" are "yellow", "cyan", and "magenta" respectively. Or you could just use colour names...

Just a wee plug for my next concert. :)

Darren's R Top Tips! Neither XML not JSON are really designed to be hand-written, but they could be. But both can be both read and written to files where a table just won't do. An advantage of XML is that you can write XML schemas which ensure data files are well formed and adhere to standards.

I just called this decade the Twotie Twoties and I'm running with that now.

Darren's R Top Tips! Another option with more freeform data structures in R is to use JSON, e.g. using the jsonlite package. JSON is a data format used widely in JavaScript and it's pretty compact compared with XML. E.g. {"name": {"given":"Darren", "family":"Green"}}

I suspect publicly available generative AI will plateau, not consistently improve. Improving it is going to take a lot of energy, and computing time, and costs. It'll improve till it's just good enough to avoid huge criticism, but still be worse than what we had before that required staff.

Darren's Top Tips! For those not aware, XML is like HTML in that you hierarchically tag material with start <foo> and end </foo> tags that can be nested. E.g. <name><given>Darren</given><family>Green</family></name></xml>

Stamp Duty is a ghetto tax. It is a tax on mobility and limits the ability of the workforce to be responsive to needs. It affects those who are most affected by low opportunities, unemployment or poor personal circumstances. @teamlabouruk.bsky.social

Darren's R Top Tips! R data frames are fine when you have a rectangular dataset, but what about for something that's more freeform? One option is to use an XML file structure. An easy package for loading and traversing XML data structures is xml2.

You know, wondering if ALL the drama over the last few years with Twıtter has been purely to position Titler into getting his grubby little paws on the Treasury. That sounds a very long game though, and not plausible given his general character and apparent attention span.

Darren's R Top Tips! A nasty pitfall with slicing matrices is R's tendency to simplify types. Compare the output of the two matrix slices below... M <- outer(1:10,1:10) M[1,] M[1:2,]

Darren's R Top Tips! The difference between && and & AND and || and | OR is that the single-symbol forms are vectorised. E.g. c(1,1,0,0) & c(1,0,1,0) The operator ! is also vectorised. For bitwise operators, you need e.g. bitwAnd(35,7)

Darren's R Top Tips! Without pass by reference semantics, the easiest way to return multiple results from an R function is to use a list. E.g. F <- function() {return(list(x=1,y=2))} print(F())

Darren's R Top Tips! Unlike in C++, braces in R don't automatically create a new variable scope, as demonstrated by: a <- 2; {a <- 3}; print(a) a <- 2; for (i in 1) {a <- 3}; print(a) Functions though do have their own environment.

Darren's R Top Tips! Use "print(foo)" in code rather than merely "foo". Foo alone will print itself at the console, but not in functions and not in loops, thus if you want diagnostic output, it's best to get into the habit of using print().

Darren's (Powerpoint today) Top Tips! Saving a slide hi-res? Alt-F11 + Ctrl+G in Windows. Then type e.g. ActivePresentation.Slides(1).Export "c:\temp\Fig1.tif","TIF",4800 and enter to save slide 1 with a given size. Saves tinkering with the registry.