Hi!

If you run `?t.test`

, you will get to the documentation for t.test, there you will see that the first argument is `x`

and the second argument is `y`

. If you are in doubt, you can also always specify which one is which by using something like this: `t.test(x=group1, y=group2) `

.

Besides this, it also seems like your are not using the function correctly. When using `t.test(x,y)`

, you are comparing the mean of group x with the mean of group y. In your example, that means that you are comparing the mean of the variable `sex`

with the mean `Pknowledge`

, which is in no way a meaningful comparison.

In your second attempt you are doing it almost correct, the only mistake here is that you have the formula such as `variable ~ group`

, in your case that would be `t.test(Pknowledge ~ Sex, data=nes200)`

. If you use this form, the output will even be coded according to your grouping variable.