Skip to content

Instantly share code, notes, and snippets.

@ansakoy
Created October 6, 2013 19:37
Show Gist options
  • Save ansakoy/6858212 to your computer and use it in GitHub Desktop.
Save ansakoy/6858212 to your computer and use it in GitHub Desktop.
Computing for Data Analysis Programming assignment 2 (part 3)
corr <- function(directory, threshold = 0) {
source("getmonitor.R")
source("complete.R")
all.cases <- complete("specdata", id = 1:332)
needed.cases <- subset(all.cases, all.cases$nobs > threshold)
result <- numeric(0)
id <- needed.cases$id
for (i in id) {
data <- getmonitor(i, "specdata")
crl <- cor(data$sulfate, data$nitrate, use = "pairwise.complete.obs")
result <- c(result, crl)
}
return (result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment