# NIST Example -- nist.r source code # Read dataset data = read.table("nist.txt", header=TRUE) print(data) weight = data$Weight print("100 weights of 10g weight:") print(weight) # Compute univariate statistics: print("Mean:") print(mean(weight)) print("Standard deviation:") print(sd(weight)) print("Variance:") print(var(weight)) print("Some percentiles:") print(quantile(weight, c(0.5, 0.10, 0.25, 0.50, 0.75, 0.90, 0.95))) print("Median:") print(median(weight)) # Create plots pdf("nist.pdf") hist(weight) qqnorm(weight) boxplot(weight) # Restore graphics output to Windows default. dev.off( )