Description Usage Arguments Details Value Returning graphics of examples Author(s) References See Also Examples
This function generates slides for displaying information (including questions to be asked) and for the subjects to insert answers. 7 types of slides are available (the argument type specifies this; see Arguments below).
For type=1 or 2, the slide is solely for display purpose (e.g. showing the instructions of the survey or background information) and responses from the subject are not needed.
For other values of type, a 5column matrix is returned. The column names are ID, Question.number, type, Condition.Likert and Response. Also see Values below.
The number of rows is determined by the number of responses gathered by the slide. For example, for type=2 only one reponse is allowed to be given by the subject therefore there will be a 1x5 matrix returned.
The below table (in a few partitions) shows the number of allowed responses for different values of type,
type=  Slide type  Allowed responses 
     
1  Timerestricted display  0 
2  Timeunrestricted display  0 
3  Numerical response display  1 
4  Multiple choice response display  Freely set and up to the number of 
available choices (n.select)  
5  Sequential Likertscale response display  The number of conditions 
given (the length of cond)  
6  "Number line marking" response display  Freely set (n.select) 
7  GaborGranger method display  1 
1 2 3 4  slide(id, type, title, content, h, v, size, col, time = NULL, interval = c(Inf, Inf),
isinteger = F, choices = NULL, layout = NULL, n.select = NULL, box.level = NULL,
cond = NULL, scale = NULL, grid = NULL, range = NULL, unit = NULL, initial = NULL,
increment = NULL, order = c("ascending", "descending"), Extra = NULL, Line.draw = NULL)

Which arguments are required depend on the slide type (the value of type). The below table gives a summary as well as the input type of each argument.
type=  id  title  content  h  v  size 
             
1  Required  Required  Optional  Optional  Optional  Optional 
2  Required  Required  Optional  Optional  Optional  Optional 
3  Required  Required  Optional  Optional  Optional  Optional 
4  Required  Required  Optional  Optional  Optional  Optional 
5  Required  Required  Optional  Optional  Optional  Optional 
6  Required  Required  Optional  Optional  Optional  Optional 
7  Required  Required  Optional  Optional  Optional  Optional 
             
Input type:  numeric(1)  character(1)  character()  numeric()  numeric()  numeric() 
type=  col  time  interval  isinteger  choices 
           
1  Optional  Required  
2  Optional  
3  Optional  Optional  Optional  
4  Optional  Required  
5  Optional  
6  Optional  
7  Optional  
           
Input type:  character()  numeric(1)  numeric(2)  logical(1)  character() 
or numeric( )  
type=  layout  n.select  box.level  cond 
         
1  
2  
3  Required  
4  Required  Required  Required  
5  Required  Required  
6  Required  Required  
7  Required  
         
Input type:  numeric(2)  numeric(1)  numeric(1)  numeric() 
or numeric(2)  or character()  
if type=3  
type=  scale  grid  range  unit 
         
1  
2  
3  
4  
5  Required  
6  Required  Required  Optional  
7  
         
Input type:  numeric()  numeric(1)  numeric(3)  character(1) 
or character()  or numeric(1)  
type=  initial  increment  order 
       
1  
2  
3  
4  
5  
6  
7  Required  Required  Required 
       
Input type:  numeric(1)  numeric(1)  "ascending" 
or "descending"  
type=  Extra  Line.draw 
     
1  Optional  Optional 
2  Optional  Optional 
3  Optional  Optional 
4  Optional  Optional 
5  Optional  Optional 
6  Optional  Optional 
7  Optional  Optional 
     
Input type:  list(list(),list(),...)  character() 
commands to be executed  
id 
numeric(1); The id of the subject. It is part of the returning value of the function (ID) for the purpose of identifying the subject. 
type 
numeric(1), 1,2,...,7; specifies the type of the slide. Details as below,

title 
character(1); the title to be displayed on the top of the slide. Should be made as short as possible since it will appear in one of the returning values Question.number. In fact, it is recommended to use titles like "Question 1" and "Demopgrahics 1" etc. 
content 
character(); texts to be displayed in the slide. It can be a vector c( ) containing multiple items. Each item must be quoted. Note: for type=5 or 7 the first component becomes the question that cond is attached to. cond is placed after content. 
h 
numeric(), [0,100];the horizontal location of content hence its length must be the same as that of content. Must be in the interval [0,100]. 
v 
numeric(), [0,100];the vertical location of content hence its length must be the same as that of content. Must be in the interval [0,100]. 
size 
numeric(); the font size of content hence its length must be the same as that of content. 
col 
character(); the colour of content hence its length must be the same as that of content. 
time 
(only applies to type=1); numeric(1) the amount of time (in seconds) that the slide is displayed. 
interval 
(only applies to type=3); numeric(2) the permitted interval the numerical response can fall within. 
isinteger 
(only applies to type=3); logical(1) TRUE if the numerical response is only allowed to be an integer. 
choices 
(only applies to type=4); character() or numeric() the choices the subject can choose from. 
layout 
(only applies to type=4); numeric(2) the layout (number of rows and columns respectively) of the choices. 
n.select 
(only applies to type=4,6); numeric(1) the number of choices can be selected if type=4 or the number of selection can be made if type=6. 
box.level 
(only applies to type=3,4,5,6,7); numeric(2), [0,100] if type=3 defines the vertical location of the top of the first box of the choices. 
cond 
(only applies to type=5); character() or numeric() a vector of conditions asked in the sequential Likertscale question. Example: if content=c("The
price is","Please choose one of the following") 
scale 
(only applies to type=5); character() or numeric() a set of Likert items the subject can choose from. 
grid 
(only applies to type=6); numeric(1) the number of minor grids lines to be drawn in between any two tick marks in range. 
range 
(only applies to type=6); numeric(3) a set of numbers to be displayed as ticks on the number line. The maximum and the minimum become the two ends of the number line. 
unit 
(only applies to type=6); character(1) or numeric(1) to be displayed as the unit (such as "$", "%", etc.) of the figures on the number line. This is placed right underneath the number line. 
initial 
(only applies to type=7); numeric(1) the starting value serves as the condition attached to the first sequential question in GaborGranger method. Subsequent conditions will decrease (if order="descending") or increase (if order="ascending") with the increment of increment. 
increment 
(only applies to type=7); numeric(1) the amount that the condition increases or decreases by (see initial above). 
order 
(only applies to type=7); "ascending" or "descending" It defines increasing or decreasing conditions attached to the sequential question. 
Extra 
See Details below for usage and details 
Line.draw 
See Details below for usage and details 
Extra
This argument aims to create plots and tables in the slide hence Extra is one of the optional arguments in slide. The usage of this argument must follow the list containing sublists format: slide(... ,Extra=list( list(), ... ), ...).
For example, Extra=list(list(...,type="p",...),list(type=...,"p",...)
,list(type=...,"t",...)) refers to two point plots and a table to be created while
Extra=list(list(type="h2",...) while refers to a relativefrequency histogram to be created.
The "list containing sublists" format must always be used regardless of the number of plots and tables.
What arguments are required in each sublist depend on type.
The below table (in a few partitions) gives a summary,
type=  loc  sublist[[1]]  sublist[[2]] 
       
p (Point plot)  Required  Required  Required 
l (Line plot)  Required  Required  Required 
b (Both point & line plot)  Required  Required  Required 
h1 (Histogram  Required  Required  
with frequency)  
h2 (Histogram with  Required  Required  
relative frequency)  
t (Table)  Required  
       
Input type:  numeric(4)  numeric()  numeric() 
or character()  
type=  ticks  xlabl  ylabl 
       
p (Point plot)  Required  Optional  Optional 
l (Line plot)  Required  Optional  Optional 
b (Both point & line plot)  Required  Optional  Optional 
h1 (Histogram  Required  Optional  Optional 
with frequency)  
h2 (Histogram with  Required  Optional  Optional 
relative frequency)  
t (Table)  
       
Input type:  list(2) if type="p","l","b"  character(1)  character(1) 
or list(1) if type="h1","h2"  
type=  title  col  table  size 
         
p (Point plot)  Optional  
l (Point plot)  Optional  
b (Both point & line plot)  Optional  
h1 (Histogram  Optional  Optional  
with frequency)  
h2 (Histogram with  Optional  Optional  
relative frequency)  
t (Table)  Required  Required  
         
Input type:  character(1)  character()  matrix()  numeric(3) 
loc: numeric(4) the location of the plot or table. These four numbers defines the left, lower, right and upper bound of the plot or table.
sublist list[[1]]: numeric() or character() The first component of the sublist. If type="p" , "l" or "b", this is the data shown on the xaxis. If type="h1" or "h2", this is the data whose frequency or relative frequency will be evaluated.
sublist list[[2]]: numeric() The second component of the sublist, this is the data shown on the yaxis.
ticks: list(2) if type="p","l","b" or list(1) if type="h1","h2" For type="p","l" or "b", ticks[[1]] and ticks[[2]] become the tick marks of the x and yaxis respectively. For type="h1" or "h2", ticks[[1]] becomes the tick marks on the yaxis.
xlabl: character() The lable of the xaxis. The name attached to list[[1]] will be used instead.
ylabl: character() The lable of the yaxis. The name attached to list[[2]] will be used instead.
title: character() The title of the plot.
col: character() The colour of each bar for type="h1","h2". The bars are not coloured (or white) if NULL.
table: a matrix with dimnames( ). The table will be created with the dimension and, with the row & column names the same as that of table.
item: numeric(3) refers to the font size of the row, column names then intable information.
Line.draw
A single or a set of double quoted R commands. Any texts in between the quotes will be executed. A vector c( ) is used for multiple commands.
Since the double quotes are reserved in this case, single quotes should be used in the commands instead. For example, Line.draw="abline(v=0,col=\bold{'}red\bold{'})"
instead of Line.draw="abline(v=0,col=\bold{"}red\bold{"})".
A 5column matrix is returned in the R console. The column names are ID, Question.number, type, Condition.Likert and Response.
ID shows id.
Question.number is title but without spaces.
type is type, the slide type (a integer between 1 and 7).
Condition.Likert is the cond in the sequential Likertscale question, shown as NA if type is not 7.
Response is the response given by the subject. Therefore, the number of rows may vary depending on number of the response. The returning values of each slide type is described below,
No values returned.
No values returned.
The numerical response given by the subject by clicking the virtual keyboard upon the restrictions of interval and isinteger.
A number representing the choice selected (i.e. "1" refers to the first choice being selected, "2" to the second, ...). The number of rows then depends on how many choices the subject is allowed to select as controlled by n.select.
The exact choice (one of the items in scale) the subject selects. That is, if scale is of character() so is the response. The number of rows depends on the number of conditions being asked (i.e. length of cond). Also see Condition.Likert above for another returning value.
A number that the mark (or marks if multiple selections allowed) represents on the number line. The number of rows then depends on how many selections (i.e. marks) the subject is allowed to make as controlled by n.select.
The number (the price in the Gabor & Granger 1966 1979) asked in the sequential question in which the subject answers "No".
Char Leung
Gabor, G & Granger, CWJ (1966) "Price as an indicator of Quality: Report on an Enquiry", Economica, 33(129), pp.4370.
Gabor, G & Granger, CWJ (1979) "The Attitude of the Consumer to Prices", Management Decision, 17(8), pp.619634.
Kanayet, F & Opfer, J (2009) "Why Children's Numberline Estimates Follow Fechner's Law", Cognitive Science Conference Proceedings 2009, pp.193641.
Siegler, RS & Opfer, JE (2003) "The Development of Numerical Estimation: Evidence for Multiple Representations of Numerical Quantity", Psychological Science, 14(3), May 2003, pp.237243.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44  ## Not run: slide(id=1234,type=1,title="Question 1",content=c("Testing1","Testing2"),
h=c(0,0),v=c(100,80),size=c(3,2),col=c("blue","pink"),time=4,Line.draw=c("abline
(h=seq(0,100,50),col='red',lty=4)","abline(v=seq(0,100,100),col='green')"))
## End(Not run)
## Not run: slide(id=1234,type=2,title="Instructions",content=c("* Please give
genuine response according to your belief.","* Any part of the survey is
irreversible meaning that you cannot change the\n response you give in the previous
slide.","* Once you click on any green button you proceed to the next slide."),
h=c(0,0,0),v=c(80,70,55),size=c(2,2,2),col=c("black","black","black"))
## End(Not run)
## Not run: slide(id=1234,type=3,title="Question 2",content="What is the average
score of all groups?",h=0,v=100,size=2,col="black",box.level=c(70,100),Extra=list
(list(date=c(rep("BoysPass",6),rep("GirlsPass",4),rep("BoysFail",4),
rep("GirlsFail",2)),type="h1",loc=c(10,30,40,60),ticks=list(seq(0,6,1)),
xlabl="Grades",ylabl="Number\nof\nass\n& fail",title="Grade distribution",
col=c(rep("skyblue",2),rep("red",2))),list(Table=matrix(c(rep(c("M","F"),2),
round(rnorm(4,100,10),2),rep("Test A",2),rep("Test B",2)),ncol=4,byrow=T,
dimnames=list(c("Gender","Average\nScore","Test\ntype"),paste("Group",1:4))),
size=c(1.5,1.5,2),type="t",loc=c(55,30,90,60))))
## End(Not run)
## Not run: slide(id=123,type=4,title="Question 3",content=c("What do you think
the return on the 2015May21 will be?","Please choose one of the followings"),
h=c(0,0),v=c(90,80),size=c(2,1.5),col=c("black","blue"),choices=c("Goes down",
"Remains the same","Goes up"),layout=c(1,3),box.level=75,n.select=1,
Extra=list(list(Date=paste("2015May",1:20,sep=""),return=rnorm(20),type="b",
loc=c(20,10,80,50),ticks=list(c(seq(0,20,5)),c(seq(2,3,1))),ylabl="Return",
title="Daily return")))
## End(Not run)
## Not run: slide(id=123,type=5,title="Question 4",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: slide(id=123,type=6,title="Question 5",content="Within which two numbers
do you think the return on the 2015May21 will fall into?",h=0,v=100,size=2,
col="black",range=seq(3,3,1),grid=5,unit="%",box.level=85,n.select=2,Extra=
list(list(Date=paste("2015May",1:20,sep=""),return=rnorm(20),type="b",loc=
c(20,10,80,45),ticks=list(c(seq(0,20,5)),c(seq(2,3,1))),ylabl="Return",title=
"Daily return")))
## End(Not run)
## Not run: slide(id=123,type=7,title="Question 6",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)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.