11. # Sample data x < - 1:10 y < - x^2 z < - c(4, 7, 1, 8, 5) # Set up layout for 3 plots in one row par(mfrow = c(1, 3)) # Scatter plot plot(x, y, main = "Scatter Plot", xlab = "X", ylab = "Y", pch = 19, col = "blue") # Line graph plot(x, y, type = "l", main = "Line Graph", xlab = "X", ylab = "Y", col = "red", lwd = 2) points(x, y, pch = 19, col = "red") # Bar chart barplot(z, names.arg = x, main = "Bar Chart", xlab = "X", ylab = "Values", col = "steelblue") # Reset plotting layout to default par(mfrow = c(1, 1)) 12. # Sample data matrix set.seed(123) data < - matrix(rnorm(30), nrow = 10) # Compute distance matrix (Euclidean distance) dist_matrix < - dist(data) # Perform hierarchical clustering (complete linkage method) hc < - hclust(dist_matrix, method = "complete") # Plot the dendrogram to visualize hierarchical relationships plot(hc, main = "Dendrogram of Hierarchical Clustering", xlab = "Data Points", ylab = "Height") # Optional: Highlight clusters by cutting the tree into 3 clusters rect.hclust(hc, k = 3, border = "blue")