A package to set up a questionnaire & enter data
Not an R package, but EpiData is free software designed to to exactly this. It's a wonderful piece of software. Define fields, add annotations, provide defaults, provide allowable values or ranges, calculate one field based on entry to another, conditional skipping from one question to another depending on answer, relational database capaability, double-entry verification, and more. I don't think it exports directly to Rdata format, but it can export to plain text, SAS, Stata, dBase, and Excel, any of which I think can be read into R. --Chris Ryan ---- Original message ----
Date: Thu, 11 Dec 2008 12:51:10 +0100
From: David Croll <david.croll at gmx.ch>
Subject: Re: [R] A package to set up a questionnaire & enter data
To: r-help at r-project.org
Hello,
For entering data alone, you would not need a package. For simple
questionnaires, you could write a function.
It could go like this. For example you want to record people's names and
their ages:
# Sets up an empty database
database <<- c()
enter_data <- function() {
show("Enter name:")
name <- as.character(readline())
show("Enter age:")
age <- as.numeric(readline())
# Appends data from one questionnaire to the
# database
database <<- rbind(database,data.frame(name,age))
# Calls the function in order to proceed
# with another questionnaire
enter_data()
# stop the function using the "stop" button when you are finished
}
exporting "database" into a CSV or a text file should not be a problem
with write.csv() or write.csv2().
Kind regards,
David Croll
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.