Arithmetic Test R Code (part 2)

new.condition
function (conditions.so.far = newmath$condition)
{# get new condition name
#
#            conditions.so.far       vector of conditions so far
#
cat(“current time”,as.character(Sys.time()),”\n”)
t=as.character(tail(conditions.so.far,1)) #malfunctions without as.character
cat(“most recent condition”,t,”\nthis condition”)
condition=scan(nlines=1,what=”character”,quiet=TRUE, sep=”!”)
condition
}

> newmath2.problems
problem answer
[1,] “2*7″Â Â “4″
[2,] “1*7″Â Â “7″
[3,] “4+4″Â Â “8″
[4,] “8+5″Â Â “3″
[5,] “11-2″Â “9″
[6,] “4+6″Â Â “0″
[7,] “0*8″Â Â “0″
[8,] “0+4″Â Â “4″
[9,] “9*3″Â Â “7″
[10,] “16-9″Â “7″
[11,] “6*8″Â Â “8″
[12,] “7*6″Â Â “2″
[13,] “0+0″Â Â “0″
[14,] “10-9″Â “1″
[15,] “1*1″Â Â “1″
[16,] “8*8″Â Â “4″
[17,] “14-7″Â “7″
[18,] “5+5″Â Â “0″
[19,] “7-3″Â Â “4″
[20,] “3+5″Â Â “8″
[21,] “0+7″Â Â “7″
[22,] “4-4″Â Â “0″
[23,] “1+8″Â Â “9″
[24,] “4*1″Â Â “4″
[25,] “3*1″Â Â “3″
[26,] “3-2″Â Â “1″
[27,] “7*9″Â Â “3″
[28,] “0+8″Â Â “8″
[29,] “1*2″Â Â “2″
[30,] “9*1″Â Â “9″
[31,] “0*0″Â Â “0″
[32,] “7+1″Â Â “8″
[33,] “2-2″Â Â “0″
[34,] “4+5″Â Â “9″
[35,] “11-4″Â “7″
[36,] “4+3″Â Â “7″
[37,] “1*0″Â Â “0″
[38,] “1*4″Â Â “4″
[39,] “12-8″Â “4″
[40,] “7*1″Â Â “7″
[41,] “2-1″Â Â “1″
[42,] “4*6″Â Â “4″
[43,] “9-6″Â Â “3″
[44,] “12-3″Â “9″
[45,] “4+9″Â Â “3″
[46,] “9+4″Â Â “3″
[47,] “9*7″Â Â “3″
[48,] “15-7″Â “8″
[49,] “3*3″Â Â “9″
[50,] “8-0″Â Â “8″
[51,] “8*9″Â Â “2″
[52,] “11-8″Â “3″
[53,] “2*2″Â Â “4″
[54,] “10-2″Â “8″
[55,] “9+8″Â Â “7″
[56,] “8-4″Â Â “4″
[57,] “2+1″Â Â “3″
[58,] “8+3″Â Â “1″
[59,] “7-6″Â Â “1″
[60,] “3-3″Â Â “0″
[61,] “9*9″Â Â “1″
[62,] “8+1″Â Â “9″
[63,] “6*4″Â Â “4″
[64,] “9+9″Â Â “8″
[65,] “4*2″Â Â “8″
[66,] “6-5″Â Â “1″
[67,] “7+5″Â Â “2″
[68,] “9*0″Â Â “0″
[69,] “3*7″Â Â “1″
[70,] “8*1″Â Â “8″
[71,] “2+8″Â Â “0″
[72,] “0+2″Â Â “2″
[73,] “8+0″Â Â “8″
[74,] “5-4″Â Â “1″
[75,] “6-3″Â Â “3″
[76,] “2*0″Â Â “0″
[77,] “15-6″Â “9″
[78,] “1*9″Â Â “9″
[79,] “7-0″Â Â “7″
[80,] “12-9″Â “3″
[81,] “9+3″Â Â “2″
[82,] “4+7″Â Â “1″
[83,] “1+7″Â Â “8″
[84,] “6-4″Â Â “2″
[85,] “6+7″Â Â “3″
[86,] “0+3″Â Â “3″
[87,] “6+3″Â Â “9″
[88,] “13-5″Â “8″
[89,] “6+1″Â Â “7″
[90,] “16-8″Â “8″
[91,] “6+5″Â Â “1″
[92,] “8*6″Â Â “8″
[93,] “4*0″Â Â “0″
[94,] “5+4″Â Â “9″
[95,] “6+4″Â Â “0″
[96,] “3*9″Â Â “7″
[97,] “4+8″Â Â “2″
[98,] “5-3″Â Â “2″
[99,] “7+0″Â Â “7″
[100,] “15-8″Â “7″
[101,] “7*3″Â Â “1″
[102,] “3+7″Â Â “0″
[103,] “6+2″Â Â “8″
[104,] “4-3″Â Â “1″
[105,] “11-3″Â “8″
[106,] “9+2″Â Â “1″
[107,] “5-5″Â Â “0″
[108,] “7+6″Â Â “3″
[109,] “9+1″Â Â “0″
[110,] “1*3″Â Â “3″
[111,] “1+2″Â Â “3″
[112,] “2+0″Â Â “2″
[113,] “6-2″Â Â “4″
[114,] “13-9″Â “4″
[115,] “2*1″Â Â “2″
[116,] “9+0″Â Â “9″
[117,] “9-1″Â Â “8″
[118,] “3-0″Â Â “3″
[119,] “12-4″Â “8″
[120,] “2+9″Â Â “1″
[121,] “10-6″Â “4″
[122,] “1+0″Â Â “1″
[123,] “4-0″Â Â “4″
[124,] “0*2″Â Â “0″
[125,] “9*2″Â Â “8″
[126,] “14-5″Â “9″
[127,] “5-1″Â Â “4″
[128,] “9-5″Â Â “4″
[129,] “3+0″Â Â “3″
[130,] “17-8″Â “9″
[131,] “2+7″Â Â “9″
[132,] “5+6″Â Â “1″
[133,] “8-1″Â Â “7″
[134,] “7-5″Â Â “2″
[135,] “3+6″Â Â “9″
[136,] “6*0″Â Â “0″
[137,] “0*4″Â Â “0″
[138,] “1*8″Â Â “8″
[139,] “7-4″Â Â “3″
[140,] “7+2″Â Â “9″
[141,] “6-6″Â Â “0″
[142,] “9-9″Â Â “0″
[143,] “10-7″Â “3″
[144,] “3+1″Â Â “4″
[145,] “2+5″Â Â “7″
[146,] “5+9″Â Â “4″
[147,] “5+3″Â Â “8″
[148,] “8+6″Â Â “4″
[149,] “0*5″Â Â “0″
[150,] “0+9″Â Â “9″
[151,] “1-1″Â Â “0″
[152,] “3-1″Â Â “2″
[153,] “7*2″Â Â “4″
[154,] “7+4″Â Â “1″
[155,] “7+3″Â Â “0″
[156,] “1+1″Â Â “2″
[157,] “6+6″Â Â “2″
[158,] “9-7″Â Â “2″
[159,] “9-8″Â Â “1″
[160,] “9*8″Â Â “2″
[161,] “2*4″Â Â “8″
[162,] “8-5″Â Â “3″
[163,] “14-6″Â “8″
[164,] “9-2″Â Â “7″
[165,] “7*4″Â Â “8″
[166,] “6+8″Â Â “4″
[167,] “16-7″Â “9″
[168,] “4*3″Â Â “2″
[169,] “8+4″Â Â “2″
[170,] “8+2″Â Â “0″
[171,] “0*9″Â Â “0″
[172,] “6*2″Â Â “2″
[173,] “10-1″Â “9″
[174,] “4-2″Â Â “2″
[175,] “3*8″Â Â “4″
[176,] “4-1″Â Â “3″
[177,] “7-7″Â Â “0″
[178,] “9-0″Â Â “9″
[179,] “2*6″Â Â “2″
[180,] “12-5″Â “7″
[181,] “0-0″Â Â “0″
[182,] “0*7″Â Â “0″
[183,] “2+6″Â Â “8″
[184,] “0*6″Â Â “0″
[185,] “11-7″Â “4″
[186,] “0*3″Â Â “0″
[187,] “18-9″Â “9″
[188,] “5+2″Â Â “7″
[189,] “4+0″Â Â “4″
[190,] “8*4″Â Â “2″
[191,] “8*3″Â Â “4″
[192,] “8-8″Â Â “0″
[193,] “0*1″Â Â “0″
[194,] “7+7″Â Â “4″
[195,] “2+2″Â Â “4″
[196,] “13-6″Â “7″
[197,] “8*0″Â Â “0″
[198,] “5*0″Â Â “0″
[199,] “8+9″Â Â “7″
[200,] “3+8″Â Â “1″
[201,] “1+3″Â Â “4″
[202,] “2*9″Â Â “8″
[203,] “5-2″Â Â “3″
[204,] “10-3″Â “7″
[205,] “4*7″Â Â “8″
[206,] “8-6″Â Â “2″
[207,] “11-9″Â “2″
[208,] “1-0″Â Â “1″
[209,] “9+5″Â Â “4″
[210,] “6*7″Â Â “2″
[211,] “3*0″Â Â “0″
[212,] “10-8″Â “2″
[213,] “3*4″Â Â “2″
[214,] “1+6″Â Â “7″
[215,] “13-4″Â “9″
[216,] “3+9″Â Â “2″
[217,] “5+8″Â Â “3″
[218,] “17-9″Â “8″
[219,] “0+1″Â Â “1″
[220,] “8-7″Â Â “1″
[221,] “7*0″Â Â “0″
[222,] “5+7″Â Â “2″
[223,] “2-0″Â Â “2″
[224,] “4*8″Â Â “2″
[225,] “3+4″Â Â “7″
[226,] “1+9″Â Â “0″

> newmath2.trial
function (trial = 1, total.trials = 5, problem=newmath2.problems[1,],condition= “testing”, wait.range=c(1500,2500), num.possible=9, note = “”)
{#give one trial. returns list with components wait, answer.msec, etc.
#(“okay” or “aborted”) and results.
#
#             trial            trial number
#             total.trials     trials per session
#             problem          problem, answer (characters)
#Â Â Â Â Â Â Â Â Â Â Â Â Â condition
#             wait.range       range of wait times (msec)
#             num.possible     number of possible wait times
#Â Â Â Â Â Â Â Â Â Â Â Â Â note
#
tn=paste(“trial”,trial,”of”,total.trials)
msg=press.space.to.start(below=tn, col = “brown”)
if(msg==”end session”) return(“end session”)
wait.msec=newmath2.foreperiod(wait.range=wait.range, num.possible = num.possible)
t=newmath2.problem(problem=problem)
newmath2.feedback(problem=problem[1],answer.msec=t$answer.msec,correct=t$correct,status=t$status)
list(wait.msec=wait.msec, answer.msec=t$answer.msec,actual.answer=t$actual.answer, correct=t$correct,include=t$include,status=t$status)
}

3 thoughts on “Arithmetic Test R Code (part 2)

  1. Seth,

    Why do you have these 226 hardcoded arithmetic problems and answers? Is there something special about how you’ve selected these problems? I know you did not want answers to be 5 or 6, but are there other criteria?

    Regards,
    Brian

  2. Brian, the main constraint is that each answer be equally likely. (Except that no answer is repeated — e.g., if the answer on trial 5 was 7, the answer on trial 6 will not be 7).

Leave a Reply

Your email address will not be published. Required fields are marked *