Say I want to do a Lowess smoothing curve for a file in excel (Independent variable, Dependent Varb) what would I have to type to do so?

I know how to read a file, but what would I do after that?

Say I want to do a Lowess smoothing curve for a file in excel (Independent variable, Dependent Varb) what would I have to type to do so?

I know how to read a file, but what would I do after that?

This is an R forum. Do you mean that you have read an Excel file into R?

If so you may find this useful FAQ: How to do a minimal reproducible example ( reprex ) for beginners

There are several ways to do what you want in R but here is an example of how to do it with the ggplot2 package using the built-it data set *iris*.

```
library(ggplot2)
ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point() +
geom_smooth(method = "loess")
```

Hi I am talking in R,

yes I mean the command

data <- read.csv('P1B_sample.csv', header = TRUE) to get the excel plot to R

I do not understand what you are doing.

```
data <- read.csv('P1B_sample.csv', header = TRUE)
```

will not read an Excel file. It only reads basic text (e.g .csv ) files.

- to get the excel plot to R*.

Is your data in an actual Excel file (extention .xlsx or .xls) or has it been exported as a .csv file? As far as I am aware you cannot import an Excel graphic into R.

If

```
data <- read.csv('P1B_sample.csv', header = TRUE)
```

is working than we have a .csv file . After that we just need to know what variables you want to plot and a sample of your data. Again have a look at he link Iprovided above.

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need.

My bad I misspoke, I turned the Excel file into a CSV so R would do it just like you said,

I have a good knowledge on these things I swear LOL,

Okay so we have the CSV and I converted it into a table on R, now I want to make it a scatter plot so I can get the Lowess smoothing curve, the purpose is to get the graph and smooth it out so I can eventually perform a lack of fit test.

I just dont know the commands to do the Lowess curve

For some reason I missed the reply notification to your post. My apologies.

Here is a simple example using *ggplot2*

```
dat1 <- data.frame(xx = 1:20, yy = sample(1:10, 20, replace = TRUE))
library(ggplot2)
ggplot(dat1, aes(xx, yy)) + geom_point() +
geom_smooth(method = "loess")
```

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.