Instructions for the assessment
There are three lists (A, B and C) of questions for this assessment.
You have been allocated one question from each list. Your allocated
questions can be accessed from the Your allocated questions
section below. You should attempt only these three allocated
questions.
You should write a SEPARATE R script for each of your allocated
questions. You should save these scripts in files named
SSSSSSSS_Ln.r, where SSSSSSSS is your student number, L is the
list (A, B or C) and n is the question number. For example, if your
student number is 12345678 and youve been allocated questions A3,
B1 and C4, your R scripts should be saved in files 12345678_A3.r,
12345678_B1.r and 12345678_C4.r respectively. Also, you must
write a separate PDF file that collates relevant output and analyses
as explained below. The file must be named SSSSSSSS.pdf
Your scripts should execute, without errors and without the need for
user intervention, when the R command source() is run on them.
Your scripts should be thoroughly commented. They should consist
of a header section summarising the logical structure, followed by the
main body of the script. The main body should itself contain
comments.
For each question, you are required to submit the following:
An electronic copy of your R script (see below).
In the single PDF file, (a) the corresponding outputs from your
script, as required by the question (b) any graphics that are
produced by your script.
Any output should correspond exactly to what appears on the screen
when sourcing your script file. Where required, comments and
interpretation of results should be summarised on the separate PDF
file along with your outputs.
Electronic copies of your scripts and PDF should be submitted via the
Submit files link located below, beneath the links to your allocated
questions .
1.
2.
3. 4.
5.
6.
7.
1.
Hints on tackling the assessment
In general, there will not be a single right answer to the questions. To obtain a good mark you need to approach the problems sensibly, and
to provide a clear justification of what youre doing. Credit will be
given for code that is clear and readable. In particular, code that is
inadequately commented will be penalised. You might like to use
scripts cosapprox.r (Lab 1) and tablet.r (Lab 3) as models.
If your script generates non-graphical output, you should ensure that
it inserts appropriate comments / labels into the output so that the
individual analyses can be identified. See question 2 at the end of
Lab 3 for an example.
You should not edit the script outputs in any way before adding them
to the submitted PDF. Marks will be deducted if your PDF output does
not correspond exactly to the results we obtain when we run your
scripts (copying and pasting is fine). Notice that you need to use the
cat() and print() commands to ensure that output appears when
you source() a file see the examples in Lab 3 for details.
Credit will be given for code that is generally applicable, rather than
tailored to a particular situation or dataset. For example, if you were
asked to print out the mean of a dataset you could do either of the
following:
Calculate the mean of the dataset before you start writing your
final script, and then insert a line cat(Mean of dataset is
5.32
)
(or whatever the mean happens to be) into your script.
In your script, create an object (say xbar) that holds the mean
of your dataset, and then insert the line cat(Mean of dataset
is,xbar,
)
into your script.
The second approach is clearly more general, is to be preferred, and
will earn more marks, since it will work for other datasets as well.
All graphs should be clearly and appropriately labelled, titled and
formatted. By appropriately formatted we mean, for example, that
axis scaling should be chosen to accommodate all of the data.
Where requested, colour graphics should be used.
The commands used should be available in the standard version of
R. In other words you should not use R libraries, or functions
downloadable from the web.
The questions in Section A are each marked out of 10. The questions
in Section B are each marked out of 15. The questions in Section C
are each marked out of 25. The marks for each question are
subdivided into components for Code, Comments and (where
relevant) Interpretation; the relative weighting of these components
varies to reflect the individual features of each question. In each
question, roughly 60% of the Code marks are for producing a script
that runs correctly and performs all analyses requested; roughly 20%
are for making the script general-purpose and for programming
intelligently; and roughly 20% are for formatting the output (including
axis labels etc.). Half of the Comments marks in each question are
2.
3.
4.
5. 6.
7. 8.
9.
for a clear header section to the script; the remainder are for clear
and appropriate commenting within the main body of the code.
Reviews
There are no reviews yet.