Skip to content

A package to set up a questionnaire & enter data

1 message · David Croll

#
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