bbb1
November 8, 2019, 7:04am
1
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 repr oducible ex ample (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
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.
nwerth
November 8, 2019, 4:29pm
4
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
```
system
Closed
November 29, 2019, 4:29pm
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.