R: assign() inside nested functions

Recently, I wrote a function called copy_names(). It does what you think and a little more: it copies names from one object to another. But it can also attempt to do so even when the sizes of the objects’ dimensions do not match up perfectly. For instance: > t = matrix(1:9, nrow=3) > t2 =…

Continue Reading

Intelligence 34 (2006): Climate and general intelligence, mini special issue

This was an exchange between researchers that took place in 2006 in the academic journal Intelligence (34). Templer, D. I., & Arikawa, H. (2006). Temperature, skin color, per capita income, and IQ: An international perspective. Intelligence, 34(2), 121-139. Jensen, A. R. (2006). Comments on correlations of IQ with skin color and geographic–demographic variables. Intelligence, 34(2),…

Continue Reading

kirkegaard: conditional recoding with conditional_change()

Usually working with large public datasets requires that one recode variables. This can be quite repetitive. When variables only have a few possible values, one can use something like plyr‘s mapvalues() for great benefit (see my answer at SO). However, when there is an indefinite number of different values, it is not useful. What one…

Continue Reading

Ethnic heterogeneity and tail effects

Chisala has his 3rd installment up: http://www.unz.com/article/closing-the-black-white-iq-gap-debate-part-3/ One idea I had while reading it was that tail effects interact with population ethnic/racial heterogeneity. To show this, I did a simulation experiment. Population 1 is a regular population with a mean of 0 and sd of 1. Population 2 is a composite population of three sub-populations:…

Continue Reading

kirkegaard: GG_group_means(), easy plotting of group means using ggplot2

Do you find yourself in need of making nice ggplot2 plots for group means over and over again? Are you tired of (re-)writing big chunks of code for something that should be easy? Here’s a solution. First install the package from Github using devtools: library(devtools) install_github(“deleetdk/kirkegaard”) Then we plot: library(kirkegaard) GG_group_means(iris, “Sepal.Length”, “Species”) But what…

Continue Reading