Displaying 1 result from an estimated 1 matches for "methods_003f".
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")