Created
April 13, 2015 10:54
-
-
Save leeper/c05536887d781e535fb0 to your computer and use it in GitHub Desktop.
Function read data from a Qualtrics-generated CSV file
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
read.qualtrics.csv <- function(filename, stringsAsFactors = FALSE, ...) { | |
n <- read.csv(filename, nrows = 1, stringsAsFactors = FALSE) | |
dat <- read.csv(filename, header = FALSE, skip = 2, stringsAsFactors = stringsAsFactors, ...) | |
names(dat) <- names(n) | |
names(dat)[1:10] <- n[1,1:10] | |
for(i in seq_along(dat)) { | |
attr(dat[,i], "question") <- n[1,i] | |
} | |
dat | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment