make a welch t test, but I need to separate my non numerical x values and test them against each other

my x values in my table are "Control" or "Air" and I need to do the t-test with those variables up against each other

this is what I tried to do, but its giving me an error for my formatting for"(subset(fishjump,Treatment=="Control")$Time~(subset(fishjump,Treatment=="Air")$Time"

t.test(subset(fishjump,Treatment=="Control")$Time~(subset(fishjump,Treatment=="Air")$Time, mu=0, alt="two.sided", conf.level = 0.95, var.equal = F, paired = F)

Without the error messages I don't understand what is happening.

However here is a simple example that should work for you. Just change the names to your data.frames names.


dat1 <-   data.frame(xx = sample(letters[1:2], 20, replace = TRUE),
                       yy = rnorm(20))

zz <-  subset(dat1, xx == "a")
aa <-  subset(dat1, xx == "b")

t.test(aa$yy, zz$yy)

its saying

Error in t.test.default(aa$Time, zz$Time) : not enough 'x' observations

because ist showing that there's o observations for aa and zz

this is what I wrote:

dat1 <- data.frame(Treatment= sample(letters[1:2], 20, replace = TRUE), Time=rnorm(20))
zz <- subset(dat1, Treatment == "Control")
aa <- subset(dat1, Treatment == "Air")

Treatment is either "a" or "b". It never equals "Control" or "Air".

dat1 is just a mock dataset.

You need to work with your dataset fishjump.

Then you would need something like

zz <- subset(fishjump, Treatment == "Control")
aa <- subset(fishjump, Treatment == "Air")

t.test(aa$Time, zz$Time)

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.