Description Usage Arguments Details Value See Also Examples
A function to a create test with specified parameters.
1 2 | createTest(n, dictionary = basicDictionary, start = 1:100, chain = 2, del = c(1, 2, 3),
seqlen = 6,exact = NULL, element_range = c(-1000, 1000))
|
n |
how many numeric sequences should be generated? |
dictionary |
a list of all rules that can be used when generating the test. Every element of this list should be an object of class |
start |
a vector specifying the allowed range for starting values. Default range is 1:100 |
chain |
How many rules can be combined together (nested) at one time. By default |
del |
refers only to |
seqlen |
how long should each numeric sequence be? |
exact |
which rules from |
element_range |
what maximum and minimum size of elements are allowed in the numeric sequence? It should be a vector of two numeric elements - first one specifying minimal values, second maximum values. If you want to define it separately for every numeric sequence it must be a list of two-element vectors. By default elements larger than 1000 and smaller than -100 are not allowed in numeric sequences. |
If createTest
is unable to generate numeric sequences which are not constant or unique with the parameters given, it will return a list of NA's
instead of numeric sequence and IdenSingleRule
as a rule used to produce it.
Function returns a list of numeric sequences [[1]]
and a list of rules to create them [[2]]
.
basicDictionary
,createDictRule
, DoubleRule
,SingleRule
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #-----------------------------------------------------------
# example 1
#-----------------------------------------------------------
m<-createTest(4) #generate a Test consisting of 4 items (all settings default)
m[[1]] # a list of items (numeric sequences)
m[[2]] # a list of rules used to create those items
#If your rule looks like this:
#name: MultConstSingleRule, constant value: 2
#name: AddConstSingleRule, constant value: 14
#name: DigSumSingleRule
#name: IdenSingleRule
#it means that you should take the sum of digits of a number,
#add 14 and multiply the result by 2
#If your rule looks like this:
#MultDoubleRule
# FIRST RULE:
#name: DigSumSingleRule
#name: AddConstSingleRule, constant value: -14
#name: IdenSingleRule
# SECOND RULE:
#name: MultConstSingleRule, constant value: -12
#name: DigSumSingleRule
#name: IdenSingleRule
# NEXT SINGLE:
#name: DigSumSingleRule
#name: AddConstSingleRule, constant value: -8
#name: IdenSingleRule
#(a) it means that you should add a constant -14 to
#the first element of numeric sequence and take digitsum of the result
#(b) take a digitsum from the second element of numeric sequence and multiply it by -12
#that multiply (a) and (b)
# in the end add -8 to the result and take the sum of digits from your calculations
#-----------------------------------------------------------
# example 2
#-----------------------------------------------------------
m<-createTest(4,seqlen=list(4,5,6,7),start=1)
# generating 4 sequences of length respectively 4,5,6,7, all starting with 1
m<-createTest(4,seqlen=list(4,5,6,7),start=7:10)
# as above, but with starting values from range 7:10
m<-createTest(4,seqlen=list(4,5,6,7),start=list(7:10,1,15:17,4))
# first sequence should have starting elements from range 1:10,
#second sequence should start with 1, thirs sequence should have
#starting element from range 15:17, fourth sequence should have
#starting element 4
m<-createTest(5,chain=0) # only one rule can be used to create every numeric sequence
m<-createTest(2,chain=list(0,1))
#the first sequence will be generated using only one rule,
#the second using two rules combined (one rule nested)
#-----------------------------------------------------------
# example 3
#-----------------------------------------------------------
sss2<-createDictRule(2,range=-10:10)
#"AddConstSingleRule" with constant value between -10 to 10
sss3<-createDictRule(3,range=2)
#"MultConstSingleRule" with constant value 2
ddd5<-createDictRule(5) #"AddDoubleRule"
ddd6<-createDictRule(6) #"MultDoubleRule"
Mydict<-list(sss2,sss3,ddd5,ddd6)
# I want to use only those rules in my test
m<-createTest(3,dictionary=Mydict,chain=0)
# a test using only rules from Mydict list
m<-createTest(4,chain=0,exact=list(c(1,2),c(2,3),c(3,4),c(1,4)))
#rules 1 and 2 can be used to create first numeric sequence, rules 2 and 3 to create second numeric sequence ...
#the 'exact' list must be of length n
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.