search for: numtails

Displaying 1 result from an estimated 1 matches for "numtails".

Did you mean: nmails
2012 Aug 03
2
Printing a summary
All, Is this typical of how people will print a summary of results? CoinTosses <- function(n) { x <- sample(c(0,1), n, replace=TRUE) y <- x y[y==0] <- "T" y[y==1] <- "H" numHeads <- sum(x) numTails <- n-sum(x) p <- numHeads/n cat(cat(y,sep=""),"\n") cat("Number of heads: ", numHeads, "\n") cat("Number of tails: ", numTails, "\n") cat("The proportion of heads is: ", p, "\n") } CoinTosses(40) Or is...