Write an R script to create a scatter plot, incorporating categorical analysis through color-coded data points representing different groups, using ggplot2.
Step 1:Load necessary libraries
#Load necessary librarieslibrary(ggplot2)
Warning: package 'ggplot2' was built under R version 4.4.3
library(dplyr)
Warning: package 'dplyr' was built under R version 4.4.3
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Step 2: Load the dataset
Explanation:
The iris dataset 150 samples of iris flowers categorized
#Load the datasetdata <- iris#display first few rowshead(data, n =10)