We’ll take some simple data from Motulsky, enter it into R by hand, and do a t-test. This will require making two R “objects” to hold the data for us.

R Functions



The Data

Motulsky 2nd Ed, Chapter 30, page 220, Table 30.1. Maximal relaxaction of muscle strips of old and young rat bladders stimualted w/ high concentrations of nonrepinephrine (Frazier et al 2006). Response variable is %E.max

## Warning: package 'knitr' was built under R version 3.3.2
Motulsky Table 30.1 Rat bladders
old young
20.8 45.5
2.8 55
50.0 60.7
33.3 61.5
29.4 61.1
38.9 65.5
29.4 42.9
52.6 37.5
14.3

Task 1: Load data

Load each column of data into a seperate R object

HINTS: You’ll need need to use:

#TYpe your attempt here:

























HINT: The basic form of the code is: * R.object <- c(datum1, )

#Type your attempt here:

























HINT: To make an object with just the first “old” datum do this

old.E.max <- c(20.8)

























HINT: To make another object with just the first “young” datum do this

young.E.max <- c(45.5)

























Loaded data

#Old data
old.E.max <- c(20.8,2.8,50.0,33.3,29.4,38.9, 29.4,52.6,14.3)

#Young data
young.E.max <- c(45.5,55.0, 60.7, 61.5, 61.1, 65.5,42.9,37.5)



T-test on rat bladders

Perform a t-test to compare the means of these 2 samples. This requires

Scroll down for the answer…

#Type your attempt here:

























t.test(old.E.max, young.E.max)
## 
##  Welch Two Sample t-test
## 
## data:  old.E.max and young.E.max
## t = -3.6242, df = 13.778, p-value = 0.002828
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -37.501081  -9.590586
## sample estimates:
## mean of x mean of y 
##  30.16667  53.71250