Skip to content

Instantly share code, notes, and snippets.

@DrNickRedfern
Created September 8, 2022 07:58
Show Gist options
  • Save DrNickRedfern/db8410547fdeb9c5aa84e5c563fa16ad to your computer and use it in GitHub Desktop.
Save DrNickRedfern/db8410547fdeb9c5aa84e5c563fa16ad to your computer and use it in GitHub Desktop.
Another illustration of vectorisation in R
# Create two vectors of equal length
X <- c(1, 3, 5, 8)
Y <- c(2, 4, 6, 7)
# Add the vectors together
X + Y
[1] 3 7 11 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment