-
Some love for Base R. Part 3
It seems a few people have found useful the reminders of base-R functionality covered in “Some love for Base R” Part 1 and Part 2. So I will keep on mentioning a few bits and pieces that you may find handy when going back to Base or even visiting it for the first time. A […]
-
Some love for Base R. Part 2
Where were we? Giving some love to base-R and putting together the idea that it is possible to write R very clearly when using base. Two sets of typical issues: Subsetting rows and columns When running analyses we often want to work on a subset of all cases (rows) or variables (columns). People are used […]
-
Some love for Base R. Part 1
For a long time it has bothered me when people look down at base-R (meaning the set of functions that comes in a default installation), as it were a lesser version of the language when compared to the tidyverse set of functions or data.table or whatever. I think part of this situation is due to […]
-
Creating an n x n autocorrelation matrix
Between covid-19 news and announcements of imminent Russia-Ukraine wars I needed a bit of a distraction. Sooo, here it is how to create an n x n autocorrelation matrix based on a correlation rho, with a simple 5 x 5 example in R: This produces the following output: [,1] [,2] [,3] [,4] [,5] [1,] 1.0000 […]
-
The beauty of code vectorisation
I came across this problem in Twitter: The basic pieces of the problem are: