Icrm 5
Icrm 5
1. The submitted file should be a combined file with all scripts, plots and the console output
showing the results of your activity.
2. The filename should be: ICRM-5.docx.
3. Do not include your name in any part of the worksheet.
4. Anything that is not designed for the computer to read should be commented out.
5. You may use any online resource to help you fulfil the worksheet requirements, but you
may not communicate to any other student in any way.
6. When you have completed all the tasks, create an R script and save it to your working
directory.
7. Open the R scripts in a word processor document and add all the plots and a copy of the
console output that you have done.
8. Upload the worksheet to Moodle (remember the file name should be ICRM-5.docx).
9. If you do not know how to do anything, then you must find the answer independently.
You cannot ask anyone for help during this practical session. Don’t forget the ever helpful
help() function.
10. You are allowed to use generative AI tools for this, but you are responsible for the code
that is included in your submission and you must acknowledge your use of AI at the top of
your submitted document. Provide the prompts that you used to generate the R code that
you then used in your script.
---Page Break---
Worksheet 5 Tasks
Basics
1. Set your working directory to a location on your computer in a folder called: Worksheet5
2. Use R to carry out arithmetic operations (addition, subtraction, multiplication, division).
b. Using your 3 variables, carry out arithmetic operations and store the output to new
variables.
c. Determine the class of your new variables.
d. Load a time series dataset from the available datasets that come with R.
e. Plot the dataset.
R Script - Basics
---Page Break---
Statistics
R Script - Statistics
# Create a plot with UrbanPop on the x-axis and Assault on the y-axis
ggplot(USArrests, aes(x = UrbanPop, y = Assault)) +
geom_point() +
labs(title = "Urban Population vs Assault", x = "Urban Population", y = "Assault Rate")
---Page Break---
Networks
R Script - Networks