R/identity.R In surveyeditor: Generate a Survey that can be Completed by Survey Respondents

Documented in identity

```identity <-
num.display<-function(xL=80,yB=4,dx=5,dy=5,fsp=1.5,conditions=c(-Inf,Inf),integer=F){
keyb<-matrix(NA,nrow=13,ncol=5)
rownames(keyb)<-keyb[,5]<-c(0,".","del",1:9,"enter")
colnames(keyb)<-c("xL","yB","xR","yT","key")
rect(xL,yB,xL+dx*3,yB+dy*4,col="yellow")
for(i in 1:13){
if(i==13){rect(xL,yB-dy,xL+dx*3,yB,col="green")
keyb[i,1:4]<-c(xL,yB-dy,xL+dx*3,yB)
else{rect(xL+(i+2)%%3*dx,yB+(i-1)%/%3*dy,xL+(i+2)%%3*dx+dx,yB+(i-1)%/%3*dy+dy)
keyb[i,1:4]<-c(xL+(i+2)%%3*dx,yB+(i-1)%/%3*dy,xL+(i+2)%%3*dx+dx,yB+(i-1)%/%3*dy+dy)
}
repeat{
repeat{
rect(xL,yB+dy*4+2,xL+dx*3,yB+dy*4+2+dy,col="orange")
sp<-0
repeat{
repeat{
ck<-locator(n=1);if(ck\$x>xL & ck\$x<(xL+3*dx) & ck\$y>(yB-dy) & ck\$y<(yB+dy*4)) break}
u<-keyb[(ck\$x>as.numeric(keyb[,1]) & ck\$x<as.numeric(keyb[,3]) & ck\$y>as.numeric(keyb[,2]) & ck\$y<as.numeric(keyb[,4])),5]
if(u=="enter" | u=="del") break
sp<-sp+fsp}
if(u=="enter"){E<-T}else{E<-F}
int<-T
id.scan<-NULL
if(type=="manual"){
par(mar=c(1,1,1,1)+0)
plot(-10,-10,xlim=c(0,100),ylim=c(0,100),xlab="",ylab="",xaxt="n",yaxt="n")
ID<-num.display(xL=42.5,yB=50)}
if(type=="auto"){
if(is.null(id.scan)!=T){
if(ncol(id.scan)==5){
un<-colnames(id.scan)==c("ID","Question.number","type","Condition.Likert","Response")