[R] T test for Single Mean

Bert Gunter gunter.berton at gene.com
Wed Jun 19 16:04:07 CEST 2013


(Re-) Read the docs (e.g. Intro to R, R Language Definition) . ...
arguments have to be named!

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

-- Bert

On Wed, Jun 19, 2013 at 6:50 AM, Sparks, John James <jspark4 at uic.edu> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list