April 2018
Beginner
238 pages
7h 13m
English
We can use the same Scatter diagram as the basis and then call upon lines to add our lowess line:
# load the iris datasetdata <- read.csv("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data")#Let us also clean up the data so as to be more readablecolnames(data) <- c("sepal_length", "sepal_width", "petal_length", "petal_width", "species")# call plot firstplot(data$sepal_length, data$petal_length)# add the lowess line to the graphlines(lowess(data$sepal_length, data$petal_length), col="blue")
Here is the resulting graph:
