OFFERS! offer image Get Expert-crafted assignments
Save 51%

STAT 260 Visualisation and Modelling in R Assignment 2 Sem 2 2026 | University of Otago

Looking for Plagiarism-Free Answers for Your US, UK, Singapore, New Zealand, and Ireland College/University Assignments?

Talk to an Expert
Published: 25 Mar, 2026
Category Assignment Subject Computer Science
University University of Otago Module Title STAT 260 Visualisation and Modelling in R
Academic Year 2026

STAT260 Assignment 2

Question 1 [1 mark]

Call the data into R. To ensure that the variables Sex and Colour are automatically converted to factors, you need to include the option stringsAsFactors = TRUE when you do so. Have a look at the first few rows of data using the head function and familiarise yourself with the data.
 
Answer:
 
setwd("C:/Users/10784/Desktop/STAT260")
 
donkey <- read.csv("donkey.csv", stringsAsFactors = TRUE)
 
donkey <- read.csv("donkey.csv", stringsAsFactors = TRUE)

Question 2 [3 marks]

Plot the body weight (y-axis) against the heart girth (x-axis). Comment on what the plot indicates about the relationship between body weight and heart girth. Does this suggest that heart girth could be used reliably as a proxy or substitute for body weight?

Answer:
 
plot(donkey$Heartgirth, donkey$Bodywt,
     main = "Body Weight vs Heart Girth",
     xlab = "Heart Girth (cm)",
     ylab = "Body Weight (kg)",
     pch = 16)
STAT 260 Visualisation Assignment 2
 
There is a strong positive relationship between heart girth and body weight. This suggests heart girth could be used as a reliable proxy for body weight since, as heart girth increases, body weight increases predictably.

Question 3 [6 marks]

Plot body weight (y-axis) against length (x-axis). Provide a second plot that also has body weight (y-axis) against length (x-axis), but plots the points with a different character for females and males. Ensure that you include a legend. Comment on what the two plots indicate about the relationship between body weight and length.
 
Answer:
 
# Plot 1: Body weight vs length
plot(donkey$Length, donkey$Bodywt,
     main = "Body Weight vs Length",
     xlab = "Length (cm)",
     ylab = "Body Weight (kg)",
     pch = 16, col = "red")
STAT 260 Visualisation Assignment 2
 
# Plot 2: With different symbols for Sex
plot(donkey$Length, donkey$Bodywt,
     main = "Body Weight vs Length by Sex",
     xlab = "Length (cm)",
     ylab = "Body Weight (kg)",
     pch = ifelse(donkey$Sex == "Male", 1, 3),
     col = "black")
legend("topleft", legend = c("Male", "Female"), pch = c(1, 3))
 
STAT 260 Assignment 2
 
Both Plot Both plot show a positive relationship between body weight and length. The second plot shows that males tend to be both longer and heavier than females on average, but the male and female donkeys tend to follow a
similar trend.

Question 4 [4 marks]

Plot the girth at the umbilicus (y-axis) against the age (x-axis). Include information about the colour of a donkey on the plot by having a different colour for each of the three categories. Comment on what the plot shows.
 
Answer:
 
# Assign colours based on Colour variable
colours <- as.numeric(donkey$Colour)
 
# Plot umbilicus girth vs age with different colours
plot(donkey$Age, donkey$Umbgirth,
     col = colours,
     pch = 16,
     main = "Umbilicus Girth vs Age by Colour",
     xlab = "Age (years)",
     ylab = "Umbilicus Girth (cm)")
 
legend("topleft", legend = levels(donkey$Colour), col = 1:3, pch = 16)
 
STAT 260
 
There is a general increase in umbilical girth with age. The plot shows that the brown and grey donkeys appear to dominate the higher girth.

Question 5 [4 marks]

The built-in R dataset ChickWeight (Cool, more chickens!), which you can access directly from the R prompt, has information from an experiment on the effect of diet on early growth of chicks (you can find more information about the dataset with help(ChickWeight)). We are
interested in visualising the relationship between chick weight and time. We are particularly interested in how this relationship might vary based on the diet the chick has. Produce a plot that shows this.
 
Answer
 
# Load ChickWeight and plot weight vs time, coloured by diet
library(datasets)
plot(ChickWeight$Time, ChickWeight$Weight,
     col = as.numeric(ChickWeight$Diet),
     pch = 16,
     main = "Chick Weight Over Time by Diet",
     xlab = "Time (days)",)
ylab = "Weight (grams)")
legend("topleft", legend = levels(ChickWeight$Diet),
       col = 1:4, pch = 16, title = "Diet")
STAT 260 Visualisation and Modelling in R
   
Chick weight increases over time, but the rate of growth varies by diet. Diet 3 and 4 show steeper increases, indicating faster growth. Visualising all diets together highlights their differing effects across time.

Buy Custom Answer Of STAT 260 Visualisation and Modelling in R Assignment

Order Non-Plagiarised Assignment

Many students in New Zealand struggle with complex management courses like STAT 260 Visualisation and Modelling in R at University of Otago (UO). Analysing real-world leaders, evaluating leadership traits, and assessing their impact on organisational culture using academic theories can be daunting. But there’s no need to worry—Assignment help in New Zealand is now easily accessible. With professional computer science assignment help, you can get 100% custom, human-written essays tailored to UO requirements. Explore our assignment samples for reassurance, and order today to secure top-quality support for your STAT 260 Visualisation and Modelling in R assignment.

Workingment Unique Features

Hire Assignment Helper Today!


Latest Free Samples for University Students

QUALIFI L5 BUS503 Business Development Assignment

Category: Assignment

Subject: Business Management

University: Qualifi

Module Title: BUS503- Business Development

View Free Samples

CII M92 – Insurance business and finance Coursework Assignment Answers

Category: CII Assignments

Subject: business

University: _______

Module Title: CII M92 – Insurance business and finance

View Free Samples

ECE5004 Professional Practicum 1: Early Childhood Education and Care Practicum Report Sample

Category: Assignment

Subject: Healthcare

University: New Zealand School of Education

Module Title: ECE5004 Professional Practicum 1: Early Childhood Education and Care

View Free Samples

BSBWHS414 Contribute to WHS Risk Management Assessment Answers Solution PDF

Category: Assignment

Subject: Management

University: _____

Module Title: BSBWHS414 Contribute to WHS Risk Management

View Free Samples

BSBWHS413 – Contribute to the implementation and maintenance of WHS consultation and participation processes Assessment Answer

Category: Assignment

Subject: Management

University: ________

Module Title: BSBWHS413 – Contribute to the implementation and maintenance of WHS consultation and participation processes

View Free Samples
Online Assignment Help in UK