=======
iris$Species <- as.factor(iris$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")
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")
==============
===============
squid <- read.csv("squid.csv")
hist(squid$GSI, xlab = "GSI", ylab = "Frequency",
main = "Histogram of GSI Values")
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")
squid$log_GSI <- log(squid$GSI)
squid$Sex_label <- ifelse(squid$Sex == 1, "Male", "Female")
boxplot(log_GSI ~ Sex_label, data = squid,
xlab = "Sex", ylab = "log(GSI)",
main = "Boxplot of log(GSI) by Sex")
boxplot(GSI ~ Location, data = squid,
xlab = "Location", ylab = "GSI",
main = "Boxplot of GSI by Location")