# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- # Part (a): # proportion_greater_than = function( x, cutoff ){ num_larger_than = sum( x > cutoff ) num_larger_than / length(x) } vec = 1:100 print( proportion_greater_than( vec, 20 ) ) print( proportion_greater_than( vec, 45 ) ) # Part (b): # #install.packages("Devore7") library(Devore7) dotplot( ex01.36$C1 ) print( proportion_greater_than( ex01.36$C1, 7*60 ) )