Skip to content
Prev 190938 / 398498 Next

Selecting groups with R

On Aug 21, 2009, at 6:35 PM, jlwoodard wrote:

            
?t,test

t.test expects two numeric vectors, not a numeric vector and a  
grouping indicator.

 > t.test(dataset[dataset$Color=="RED", "Score"], dataset[dataset 
$Color=="WHITE", "Score"] )

	Welch Two Sample t-test

data:  dataset[dataset$Color == "RED", "Score"] and dataset[dataset 
$Color == "WHITE", "Score"]
t = -7.6485, df = 3.298, p-value = 0.003305
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  -18.143205  -7.856795
sample estimates:
mean of x mean of y
  11.66667  24.66667