demo/sec3.4.R

# Table 3.4-1
with(SticklebackPlates,
	data.frame( genotype = levels(genotype),
	            frequency = as.vector(table(genotype)),
				proportion = as.vector(table(genotype)) / nrow(SticklebackPlates)
		)
	)

# Proportion is a mean
mean( SticklebackPlates$genotype == 'mm' )
mean( SticklebackPlates$genotype == 'Mm' )
mean( SticklebackPlates$genotype == 'MM' )

Try the abd package in your browser

Any scripts or data that you put into this service are public.

abd documentation built on May 2, 2019, 4:46 p.m.