[R] A package to set up a questionnaire & enter data
David Croll
david.croll at gmx.ch
Thu Dec 11 12:51:10 CET 2008
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
More information about the R-help
mailing list