read.write: Dynamic survey data storage function

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/read.write.R

Description

This function saves matrix-type responses to a nominated file. If the nominated file already exists and the responses of previous subjects are in the file, current matrix-type bundled responses will be incorporated into this file.
Note: one should bundle multiple responses (i.e. responses from multiple slide) by using the rbind function.

Usage

1
read.write(rbind.result, link)

Arguments

rbind.result

Bundled responses formed by using rbind to bind the responses from slide. As seen in slide, slide returns a 5-column matrix with column names ID, Question.number, type, Condition.Likert and Response. Therefore, responses from multiple slide must be compiled with the use of rbind.

link

The location of the file that rbind.result will be incorporated into.

Details

There are three possible the outcomes in seeking the file, link.
(1) The file link exists and it has column names ID, Question.number, type, Condition.Likert and Response (the universal format of the responses returned by slide). In this case, rbind.result is incorporated into link.
(2) The file link does not exist. In this case, the file link is generated with the column names ID, Question.number, type, Condition.Likert and Response and rbind.result is incorporated into link.
(3) The file link exists but this not have column names ID, Question.number, type, Condition.Likert and Response. This is usually the case where the file name in link is already in use. Either the file name of the existing file in the directory link or the link in this function should be altered to avoid confusion.

Value

Nothing is shown in the R console or the graphic device. Yet the file link will be altered (as rbind.result is incorporated) or will be created.

Author(s)

Char Leung

See Also

slide

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: link<-"R:/test.txt"
## Not run: id<-identity("auto",link=link)
## Not run: Q1<-slide(id=id,type=7,title="Question 1",content="Would you take the milk if 
it costs $",h=0,v=80,size=2,col="black",initial=3,increment=1,order="descending"
,box.level=70)
## End(Not run)
## Not run: Q2<-slide(id=id,type=5,title="Question 2",content=c("The market price is $"
,"(0 refers to 'Strongly disagree' ... 5 refers to 'Strongly agree')"),h=c(0,0)
,v=c(80,70),size=c(2,1.5),col=c("black","orange"),cond=seq(10,12,0.5),scale=seq(0,5,0.5)
,box.level=50)
## End(Not run)
## Not run: read.write(rbind(Q1,Q2),link=link) #rbind is used to form a bundled 
matrix-type responses
## End(Not run)

surveyeditor documentation built on May 30, 2017, 5:36 a.m.