Skip to content

Instantly share code, notes, and snippets.

@Deleetdk
Last active April 24, 2016 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deleetdk/ca13a70eb577a742a50c4f31a0f4ed14 to your computer and use it in GitHub Desktop.
Save Deleetdk/ca13a70eb577a742a50c4f31a0f4ed14 to your computer and use it in GitHub Desktop.
library(pacman)
p_load(haven, dplyr, kirkegaard)
# load data ---------------------------------------------------------------
entiredata = read.csv("Woodcock-Johnson Murray_2007.csv")
# subset ------------------------------------------------------------------
#only first two races, and two other conditions
d = subset(entiredata, racesample < 3 & wj == 1 & sample == 1)
#cognitive ability vars
v_cogvars = c("c01picvocab", "c03memsen", "c04visaudit", "c05blend", "c07vismatch", "c08antsyn", "c09analsyn", "c10numrev", "c11concform")
# plots -------------------------------------------------------------------
#plot the distribution of the data and test for normality with shapiro test
sapply(v_cogvars, FUN = function(var) {
#plot n save
GG_denhist(d, var = var)
ggsave(var + ".png")
#test for normality
shapiro.test(d[[var]])
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment