Part One - Iris flower data set or Fisher’s Iris data set is a multivariate data set used and made famous by the British statistician and biologist Ronald Fisher in his 1936 paper.

=======

** Before you start, ensure your map to your working directory where these files are located; then follow these steps: [Session] menu > [Set working directory] > [Choose directory…]. **

======

- Import the data from the iris.csv file:
iris <- read.csv("iris.csv")
1.) Plot of Petal Length vs. Petal Width:
plot(iris$Petal.Length, iris$Petal.Width,
     xlab = "Petal Length", ylab = "Petal Width",
     main = "Petal Length vs Petal Width")

2.) Create a subset() and called it ‘setosa’:
setosa_data <- subset(iris, Species == "setosa")
- Plot of Petal Length vs. Petal Width for the ‘setosa’ species:
plot(setosa_data$Petal.Length, setosa_data$Petal.Width,
     xlab = "Petal Length", ylab = "Petal Width",
     main = "Petal Length vs Petal Width for 'setosa'")

3.) Plot of Petal Length vs. Petal Width with different symbols for different species:
plot(iris$Petal.Length, iris$Petal.Width,
     xlab = "Petal Length", ylab = "Petal Width",
     main = "Petal Length vs. Petal Width with different symbols",
     pch = 1:3)

4.) Plot of Petal Length vs. Petal Width with different colors for different species:
plot(iris$Petal.Length, iris$Petal.Width, 
     xlab = "Petal Length", ylab = "Petal Width", 
     main = "Petal Length vs. Petal Width with Different Colors", 
     pch = 15:17, col = 7:9)

- Switched the format to a ‘factor’ to continue with the script:

iris$Species <- as.factor(iris$Species)
6.) Plot of Petal Length vs. Petal Width with symbols scaled by the value of Sepal Width and colored by species:
plot(iris$Petal.Length, iris$Petal.Width,
     xlab = "Petal Length", ylab = "Petal Width",
     main = "Petal Length vs Petal Width: Scaled Symbol & Colored By Species", 
     xlim = c(0,7), ylim = c(0,3), pch = 16, cex = iris$Sepal.Width, 
     col = iris$Species)
legend("topleft", legend = levels(iris$Species), pch = 16, col = 1:3, 
       title = "Species")

7.) Plot of Petal Length vs Petal Width with a smoothing line:
plot(iris$Petal.Length, iris$Petal.Width,
     xlab = "Petal Length", ylab = "Petal Width",
     main = "Petal Length vs Petal Width with Smoothing Line")
lines(lowess(iris$Petal.Length, iris$Petal.Width), col = "red")

==============

Part Two - The squid.csv focus on GSI stands for Gonadosomatic Index. It is a measure used in reproductive biology to assess the maturity and reproductive condition of organisms, particularly in relation to their gonads (reproductive organs). The GSI is calculated as the ratio of the weight of the gonads (typically ovaries or testes) to the total body weight of the organism, multiplied by 100.

===============

- Import the data from the squid.csv file.

- Load the squid data from the “squid.csv” file:
squid <- read.csv("squid.csv")
1.) Histogram of GSI values:
hist(squid$GSI, xlab = "GSI", ylab = "Frequency",
     main = "Histogram of GSI Values")

2.) Separate histograms of GSI values for male and female squid:
hist(squid$GSI[squid$Sex == 1], xlab = "GSI", ylab = "Frequency",
     main = "Histogram of GSI Values for Male Squids")

hist(squid$GSI[squid$Sex == 2], xlab = "GSI", ylab = "Frequency",
     main = "Histogram of GSI Values for Female Squids")

- Created a column to label the Sex rather than displaying values of 1 & 2:

squid$log_GSI <- log(squid$GSI)
squid$Sex_label <- ifelse(squid$Sex == 1, "Male", "Female")
3.) Boxplot showing the relationship of GSI to the sex of the squid:
boxplot(log_GSI ~ Sex_label, data = squid,
        xlab = "Sex", ylab = "log(GSI)",
        main = "Boxplot of log(GSI) by Sex")

4.) Boxplot showing the relationship of GSI to the locations where the squid were caught:
boxplot(GSI ~ Location, data = squid,
        xlab = "Location", ylab = "GSI",
        main = "Boxplot of GSI by Location")