Last active
March 8, 2017 07:19
-
-
Save jclopeztavera/0d12c0bf1fff51d2814dc51c44fcf337 to your computer and use it in GitHub Desktop.
Function to test for normality of numeric variables in a dataframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Function to test for normality of numeric variables in a dataframe | |
is.normal <- function(x) { | |
z <- lapply(x[sapply(x, is.numeric)], shapiro.test) | |
lz <- length(z) | |
y <- logical(length = lz) | |
for (i in 1:lz) { | |
if (z[[i]]$p.value >= 0.1) { | |
y[i] <- TRUE | |
} else { | |
y[i] <- FALSE | |
} | |
} | |
return(y) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment