Skip to content
Back to formatted view

Raw Message

Message-ID: <4940FEAE.4080502@gmx.ch>
Date: 2008-12-11T11:51:10Z
From: David Croll
Subject: A package to set up a questionnaire & enter data
In-Reply-To: <mailman.27.1228993206.20902.r-help@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