########## ## # Reading the data into R: my.datafile <- tempfile() cat(file=my.datafile, " AL 17.4 13.3 AR 19 10.3 AZ 13.8 9.4 CA 10.9 8.9 CO 10.2 8.6 CT 8.8 9.1 DE 13.2 11.5 FL 13.8 11 GA 17 12.5 IA 9.2 8.5 ID 10.8 11.3 IL 12.5 12.1 IN 14 11.3 KS 11.5 8.9 KY 17.4 9.8 LA 16.8 11.9 MA 8.3 8.5 MD 11.7 11.7 ME 11.6 8.8 MI 12.3 11.4 MN 7.3 9.2 MO 13.4 10.7 MS 20.5 12.4 MT 10.1 9.6 NB 8.9 10.1 NC 15.9 11.5 ND 8 8.4 NH 7.7 9.1 NJ 9.4 9.8 NM 15.3 9.5 NV 11.9 9.1 NY 9.7 10.7 OH 13.3 10.6 OK 15.6 10.4 OR 10.9 9.4 PA 11.3 10.2 RI 10.3 9.4 SC 16.6 13.2 SD 9.7 13.3 TN 17 11 TX 15.2 9.5 UT 9.3 8.6 VA 12 11.1 VT 9.2 10 WA 10.4 9.8 WI 9.9 9.2 WV 17.1 10.2 WY 10.7 10.8 ", sep=" ") options(scipen=999) # suppressing scientific notation birthrate <- read.table(my.datafile, header=FALSE, col.names=c("state", "teen", "mort")) # Note we could also save the data columns into a file and use a command such as: # birthrate <- read.table(file = "z:/stat_516/filename.txt", header=FALSE, col.names = c("state", "teen", "mort")) attach(birthrate) # The data frame called birthrate is now created. #########