Object not found help

setwd("C:/Users/Bre_h/Desktop")
getwd
Clover2019 <- read.csv("Clover2019.csv", header = TRUE, stringsAsFactors = FALSE)
str(Clover2019)
Clover2019$Site <- as.factor(Clover2019$Site)
str(Clover2019)
head(Clover2019)
summary(Clover2019) 

plot(x = jitter(as.numeric(Clover2019$Site)), y = Clover2019$Elevation.1, xlab = 'Site')  

Clover2019$Elevation.1 <- as.factor(Clover2019$Elevation.1)
cloverresult1 <- t.test(Elevation.1,Site, data = Clover2019)

it keeps saying theres an error and cant find elevation.1

Hi, welcome!

We don't have access to your local files so we can't test your code, to help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

It's hard to help because we don't have access to Clover2019.csv.
If you could provide a reprex that includes the first 6 rows of this file, it would help us help you.

To pass symbols into t.test, you need to put them in a formula (which I didn't know was an option before today):

cloverresult1 <- t.test(Elevation.1 ~ Site, data = Clover2019)

Note the ~ which makes it a formula.


Side note: you can format code on this forum by putting a line of three accent marks before and after the code block:

```
a <- 1 + 2
```