im having the error "error in eval" come up when trying to get my T-test to work can anyone work out why

so this is the code i am using as it is whats shown to be used by my uni but when i enter it i keep getting the same error any idea why ?

setwd("C:/Users/mason/OneDrive/Documents/working directory")
data =read.csv("cardata.csv")
t.test(cycles ~ mpg , data= origin_label, var.equal = T)

Here is what the code should produce

t.test(carb ~ am, data = mtcars, var.equal = TRUE)
#>  Two Sample t-test
#> data:  carb by am
#> t = -0.31565, df = 30, p-value = 0.7545
#> alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
#> 95 percent confidence interval:
#>  -1.391178  1.018709
#> sample estimates:
#> mean in group 0 mean in group 1 
#>        2.736842        2.923077

Created on 2023-04-22 with reprex v2.0.2

Why it doesn't could be due to several reasons, but I can't tell without ;a reprex (see the FAQ. So, start off by confirming that

  1. origin_label is in namespace
  2. it contains variables cycles and mpg
  3. the grouping factor has exactly two levels

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.