Using read-table to read files: *************************************************************************************************************** If the data was in a file called freeformat.dat, you would read this data with the command: data <- read.table("freeformat.dat", header=TRUE) *************************************************************************************************************** Fixed-format data can be read in with the read.table command as well. Here's an example using the above data. data2 <- read.table("fixeddata.dat", col.names=c("country", "ud", "sd"), sep = c(1,7,11)) *************************************************************************************************************** Here is the command syntax to read in comma-delimited data. data <- read.table("delimit.dat", sep = ",") *************************************************************************************************************** Read from webpage: data <- read.table('http://www.stat.wmich.edu/naranjo/stat4640/data/Grades.dat',header=F) *************************************************************************************************************** It is often helpful to cut-and-paste data onto console: > sbpdat<-read.table(stdin(), header=F) # You will see the prompt 0: # You can now paste data onto the console # (I pasted 3 columns of data in the following example) 0: 1 144 39 1: 2 220 47 2: 3 138 45 3: 4 145 47 4: 5 162 65 6: 6 142 46 7: 7 170 67 8: 8 124 42 9: 9 158 67 10: 10 154 56 11: 11 162 64 12: 12 150 56 13: 13 140 59 14: 14 110 34 15: 15 128 42 16: 16 130 48 17: 17 135 45 18: 18 114 17 19: 19 116 20 20: 20 124 19 21: 21 136 36 22: 22 142 50 23: 23 120 39 24: 24 120 21 25: 25 160 44 26: 26 158 53 27: 27 144 63 28: 28 130 29 29: 29 125 25 30: 30 175 69 31: # Press to quit input mode > summary(sbpdat) V1 V2 V3 Min. : 1.00 Min. :110.0 Min. :17.00 1st Qu.: 8.25 1st Qu.:125.8 1st Qu.:36.75 Median :15.50 Median :141.0 Median :45.50 Mean :15.50 Mean :142.5 Mean :45.13 3rd Qu.:22.75 3rd Qu.:157.0 3rd Qu.:56.00 Max. :30.00 Max. :220.0 Max. :69.00 > names(sbpdat)<-cbind("Index", "SBP", "Age") > print(sbpdat) > mean(sbpdat) Index SBP Age 15.50000 142.53333 45.13333 > sd(sbpdat) Index SBP Age 8.803408 22.581245 15.294203 > summary(sbpdat) Index SBP Age Min. : 1.00 Min. :110.0 Min. :17.00 1st Qu.: 8.25 1st Qu.:125.8 1st Qu.:36.75 Median :15.50 Median :141.0 Median :45.50 Mean :15.50 Mean :142.5 Mean :45.13 3rd Qu.:22.75 3rd Qu.:157.0 3rd Qu.:56.00 Max. :30.00 Max. :220.0 Max. :69.00