slide: Survey/questionnaire slides

Description Usage Arguments Details Value Returning graphics of examples Author(s) References See Also Examples

Description

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 5-column 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 Time-restricted display 0
2 Time-unrestricted 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 Likert-scale response display The number of conditions
given (the length of cond)
6 "Number line marking" response display Freely set (n.select)
7 Gabor-Granger method display 1

Usage

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)

Arguments

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,

  1. Time restricted display that does not allow the subject to enter any answer (that is, for display information only) and that information is displayed for a limited amount of time controlled by time.

  2. Time unrestricted display that does not allow the subject to enter any answer (like type=1) but the information is display until the subject click on the green button located in the bottom of the slide to proceed to the next slide.

  3. Numerical response display that allows the subject to give a numerical answer by clicking on the virtual keyboard. The location of the virtual keyboard is controlled by box.level.

  4. Multipe choice response display that allows that subject to choose one or more selections from the given ones. Choices are controlled by choices while the number of selection is controlled by n.select. Also see layout.

  5. Sequential Likert-scale response display that allows the subject to choose one of the Likert items. It is sequential in the sense that cond may contain multiple items where the similar questions are repeated asked but with different conditions (cond).
    For example: "The price is 10", "The price is 20", "The price is 30" are asked. Here cond=seq(10,30,10). The Likert items are controlled by scale.

  6. "Number line marking" response display allows the subject to give a perceptual numerical response (or multiple response) by clicking on the numberline (Kanayet & Opfer 2009, Siegler & Opfer 2003). The subject can only see a mark (or marks if multiple) on the number line, not the number it represents. range controls the length and the tick marks of the number line and grid controls the number of
    minor lines drawn between any two tick marks.

  7. Gabor-Granger method (Gabor & Granger 1966, 1979) display that asks sequential questions in regarding to the acceptance of prices in an ascending or descending order. The order is controlled by order. initial controls the first value to be asked and subsequent value
    will increase or decrease by increment. Subjects can choose either "Yes" or "No" and the procedure ceases when "No" is answered.

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.
numeric(1), [0,100] if type=4,5,6,7 defines the horizontal and vertical location of the virtual keyboard. Must be between 0 & 100.

cond

(only applies to type=5); character() or numeric() a vector of conditions asked in the sequential Likert-scale question. Example: if content=c("The price is","Please choose one of the following")
and cond=seq(5,15,5) then three slides will display each of the followings: "The price is 5", "The price is 10" and "The price is 15" plus "Please choose one of the following" in each of these slides. Note: the first component of content becomes the question that cond is
attached to. cond is placed after content.

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 Gabor-Granger 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
list( list(), list() ,...) A list (with usage: Extra=list()) contains another sub-list or multiple sub-lists. Each sub-list refers to a table or a diagram to be displayed hence multiple tables or diagrams are allowed.

Line.draw

See Details below for usage and details
Any quoted R commands in the form of character( ) (example: c("abline(v=0,
col='red')","lines(seq(-10,20,0.01),seq(-10,20,0.01)*1.2+100,
col='yellow')")) These commands will be executed. The aim is to provide further adjustments to the slide. Note that single-quotes ' ' should be used to avoid the confusion with the double-quotes " ".

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 sub-lists 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 relative-frequency histogram to be created.
The "list containing sub-lists" format must always be used regardless of the number of plots and tables.
What arguments are required in each sub-list depend on type.
The below table (in a few partitions) gives a summary,

type= loc sub-list[[1]] sub-list[[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)

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{"})".

Value

A 5-column matrix is returned in the R console. The column names are ID, Question.number, type, Condition.Likert and Response.

Returning graphics of examples

slide01.jpeg
slide02.jpeg
slide03.jpeg
slide04.jpeg
slide05.jpeg
slide06.jpeg
slide07.jpeg

Author(s)

Char Leung

References

Gabor, G & Granger, CWJ (1966) "Price as an indicator of Quality: Report on an Enquiry", Economica, 33(129), pp.43-70.
Gabor, G & Granger, CWJ (1979) "The Attitude of the Consumer to Prices", Management Decision, 17(8), pp.619-634.
Kanayet, F & Opfer, J (2009) "Why Children's Number-line Estimates Follow Fechner's Law", Cognitive Science Conference Proceedings 2009, pp.1936-41.
Siegler, RS & Opfer, JE (2003) "The Development of Numerical Estimation: Evidence for Multiple Representations of Numerical Quantity", Psychological Science, 14(3), May 2003, pp.237-243.

See Also

cover,identity,read.write

Examples

 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("Boys-Pass",6),rep("Girls-Pass",4),rep("Boys-Fail",4),
rep("Girls-Fail",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 2015-May-21 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("2015-May-",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 2015-May-21 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("2015-May-",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)

surveyeditor documentation built on May 2, 2019, 2:31 p.m.