Vanathaiyan S
Vanathaiyan S

Reputation: 235

How to use the right data name in the t-test results?

I am getting the below result while performing the one sample t-test

One Sample t-test

data: x()
t = 1.9628, df = 6, p-value = 0.09731
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-2.642339 24.070910
sample estimates:
mean of x 
10.71429

Here data is not getting displayed as the column name of the data I have used for this test instead it is displaying the variable name I used as part of the code. Now how to change the data name to data column name while displaying the test result?

Upvotes: 0

Views: 630

Answers (1)

drmariod
drmariod

Reputation: 11772

You can just overwrite the data.name variable of your result.

a <- t.test(c(12,3,4,5,2), c(2,34,2,4,3))
a$data.name <- 'bla bla'
a

Welch Two Sample t-test

data:  bla bla   
t = -0.58399, df = 4.6367, p-value = 0.5865   
alternative hypothesis: true difference in means is not equal to 0    
95 percent confidence interval:    
-20.92852  13.32852   
sample estimates:    
mean of x mean of y    
      5.2       9.0

Upvotes: 2

Related Questions