This is quick and dirty code that tries to reproduce the analysis and graph
from the post: “Per capita consumption of mozzarella cheese (US) correlates
with Civil engineering doctorates awarded
(US)”
Now we will reproduce the plot
And calculate the correlation (which happens to be high)
# calculate the correlation
cor(cheese, engdoc)
## [1] 0.9586
This bit was made to answer a question from a friend (Hi César!), and originally
was published as a gist: https://gist.github.com/jmcastagnetto/59c26c2624e621a13582