// Numbas version: exam_results_page_options {"name": "Query file with random data in R ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Query file with random data in R ", "tags": [], "metadata": {"description": "
Download a file and scan the values into R to obtain a numeric vector of values. Then use R to explore your numeric vector in order to find the answers to these questions.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Follow the below steps to download a file of numeric values and to read it into R
\nv
.v = scan(\"numeric.txt\")\n
Before you begin, check that the first few values of v
match the first few rows in the file.
When giving the values of vector elements, do not round your answers.
", "advice": "Solutions/feedback will be given in classes after the assessment period.
", "rulesets": {}, "extensions": [], "variables": {"seed": {"name": "seed", "group": "Ungrouped variables", "definition": "random(1..1000)", "description": "", "templateType": "anything"}, "pos2_smallest": {"name": "pos2_smallest", "group": "Ungrouped variables", "definition": "sort(list(tumbleVector(seed,vec_length,-99999,99999)/1000))[pos2-1]", "description": "the pos2th smallest value in x1
", "templateType": "anything"}, "smallest_x1": {"name": "smallest_x1", "group": "Ungrouped variables", "definition": "min(list(tumbleVector(seed,vec_length,-99999,99999)/1000))", "description": "", "templateType": "anything"}, "random_value": {"name": "random_value", "group": "Ungrouped variables", "definition": "list(tumbleVector(seed,vec_length,-99999,99999)/1000)[pos-1]", "description": "", "templateType": "anything"}, "lims": {"name": "lims", "group": "Ungrouped variables", "definition": "sort(repeat(random(-4000..4000) / 100, 4))", "description": "4 limits to be used in range based questions. These values are sorted into ascending order.
", "templateType": "anything"}, "range1": {"name": "range1", "group": "Ungrouped variables", "definition": "len(filter(x > lims[1] and x < lims[2], x, list(tumbleVector(seed,vec_length,-99999,99999)/1000)))", "description": "Number of values inside an exclusively-bounded range
", "templateType": "anything"}, "pos": {"name": "pos", "group": "Ungrouped variables", "definition": "random(1000..(vec_length-1000))", "description": "A randomly selected position in the vector
", "templateType": "anything"}, "pos2": {"name": "pos2", "group": "Ungrouped variables", "definition": "random(400..1000)", "description": "", "templateType": "anything"}, "vec_length": {"name": "vec_length", "group": "Ungrouped variables", "definition": "random(3000 .. 4000#1)", "description": "The length of the numeric vector that will be created.
", "templateType": "randrange"}, "final_value": {"name": "final_value", "group": "Ungrouped variables", "definition": "list(tumbleVector(seed,vec_length,-99999,99999)/1000)[vec_length-1]", "description": "", "templateType": "anything"}, "range2": {"name": "range2", "group": "Ungrouped variables", "definition": "len(filter(x >= lims[0] and x <= lims[3], x, list(tumbleVector(seed,vec_length,-99999,99999)/1000)))", "description": "Number of values inside an inclusively-bounded range
", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["vec_length", "pos", "pos2", "lims", "range1", "range2", "smallest_x1", "pos2_smallest", "seed", "random_value", "final_value"], "variable_groups": [], "functions": {"tumblevector": {"parameters": [["a", "number"], ["length", "number"], ["minint", "number"], ["maxint", "number"]], "type": "vector", "language": "javascript", "definition": "var v=Array();\nfor (var i=0;iv
?", "minValue": "vec_length", "maxValue": "vec_length", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "What is the value of the element in position {pos} of the vector v
?
What is the final element in the vector v?
", "minValue": "final_value", "maxValue": "final_value", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "What is the smallest value in the vector v?
", "minValue": "smallest_x1", "maxValue": "smallest_x1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "How many values in the vector v are greater than {lims[1]} and also less than {lims[2]}?
", "minValue": "range1", "maxValue": "range1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "How many values in the vector v are in the range $[\\var{lims[0]}, \\var{lims[3]}]$?
\n(Note: this range includes the values $\\var{lims[0]}$ and $\\var{lims[3]}$)
", "minValue": "range2", "maxValue": "range2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "What is the {pos2}st smallest number in the vector v?
\nWhat is the {pos2}nd smallest number in the vector v?
\nWhat is the {pos2}rd smallest number in the vector v?
\nWhat is the {pos2}th smallest number in the vector v?
\n