Quotidian

An occasionally updated blog, mostly related to programming. (Views are my own, not my employer's.)

Monday, April 19, 2021

x XOR y MOD 9 in R

I was curious what it would take to reproduce the x XOR y MOD 9 plot in R. Here's one way:
x <- 1:32
image(x, x,
    outer(x, x, FUN=function(x, y) (bitwXor(x, y) %% 9) != 0),
    col=c("white", "black"))
dev.copy(png, "~/x_xor_y_mod_9.png")
dev.off()
Looking forward to creating a GIF using the gifski package, which I learned about from gganimate, which I'm also looking forward to exploring.
Posted by util at 6:35 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2024 (2)
    • ►  January (2)
  • ►  2023 (7)
    • ►  December (1)
    • ►  October (1)
    • ►  July (1)
    • ►  June (1)
    • ►  May (2)
    • ►  February (1)
  • ►  2022 (3)
    • ►  August (2)
    • ►  January (1)
  • ▼  2021 (12)
    • ►  June (1)
    • ►  May (3)
    • ▼  April (7)
      • Notes on "Mythical Man-Month": "Why did the tower ...
      • x XOR y MOD 9 in R
      • Zooming out on x ^ y % 9
      • Rob Pike's 6 rules of programming
      • Animation of x ^ y % m for various m
      • Chapter 4 of "The Mythical Man-Month"
      • x ^ y % 9
    • ►  March (1)
  • ►  2020 (2)
    • ►  December (1)
    • ►  September (1)
  • ►  2013 (1)
    • ►  December (1)
  • ►  2009 (1)
    • ►  March (1)
  • ►  2008 (67)
    • ►  June (15)
    • ►  May (15)
    • ►  April (9)
    • ►  March (12)
    • ►  February (6)
    • ►  January (10)
  • ►  2007 (2)
    • ►  December (1)
    • ►  November (1)

About Me

util
View my complete profile
Powered by Blogger.