## Devices x <- rnorm(10000) y <- rnorm(10000) dev.list() graphics.off() plot(x,y) plot(density(x)) help(Devices) x11() plot(x,y) points(c(-.6,.6),c(.6,.6), col=c("yellow"),pch=16, cex=2) points(seq(-1,1,.02),seq(-1,1,.02)**2-1, col=c("yellow"),pch=16) dev.set(2) points(density(y), type="l", col="red") dev.copy2pdf(file="MyFinePlot.pdf") graphics.off() ## P-values y <- rnorm(10000, mean=0.2) t.test(x,y) plot(density(x)) points(density(y), type="l", col="red") #Results here depend heavily on sampling effects, but possible values are given y <- rnorm(10000, mean=0.01) t.test(x,y) #Results here depend heavily on sampling effects, but possible values are given x <- rnorm(5) y <- rnorm(5, mean=2) t.test(x,y) ## Functions cube <- function(x) { z <- x**3 return(z) } fact <- function(x) { z <- 1 for (i in 2:x) { z <- z * i } return(z) } func <- function(x, y) { z <- cube(x) - fact(y) return(z) }