[R] T test for Single Mean

Sparks, John James jspark4 at uic.edu
Wed Jun 19 15:50:28 CEST 2013


Dear R Helpers,

I am stuck on some syntax and I thought that I was following one of the
examples that I found out there quite faithfully.

I just want to know how to do a t test on a single mean for whether or not
it is greater than a specific value.  So I am using the data set sleep and
I want to know if the mean of extra is greater then zero.  I was under the
impression that the syntax is

t.test(sleep$extra,mu=0,"greater")

but I get the error message

Error in t.test.default(sleep$extra, mu = 0, "greater") :
  not enough 'y' observations

I have tried this on a few other data sets that have more then 20
observations and I get the same error.  I looked in the documentation but
the examples are for the comparison of two groups, not a single group
mean.

Any help would be most appreciated.

--John J. Sparks, Ph.D.



More information about the R-help mailing list