Making a graph out of a table in R

Say I want to do a Lowess smoothing curve off a table (Independent variable, Dependent Var) what would I have to type to do so?

I have the file as a table in R currently, from a csv but how would I make a graph/ add the Lowess curve

As in what is the script for it?

Here is an example of making a scatter plot with a loess curve. I invented some simple data to use in the plot.

#Invent data
DF <- data.frame(Xval = 1:20, Yval = rnorm(20))

library(ggplot2)
ggplot(data = DF, mapping = aes(x = Xval, y = Yval)) + 
  geom_point() + geom_smooth(formula = y ~ x, method = "loess")

Created on 2022-07-05 by the reprex package (v2.0.1)

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.