# code to read in a .txt data file #### if the file has names in the first row: # "id" "age" "height" ... "hct" # 517 68 165 ... 340 m <- read.table(file="dataset.names.txt", header=TRUE ) m[1,] # id age height ... hct # 1 517 68 165 ... 340 attach(m) #### if the file does not have names m <- read.table(file="dataset.nonames.txt", header=FALSE ) m[1,] # V1 V2 V3 ... V20 # 1 517 68 165 ... 340 id = m[,1] age = m[,2] height = m[,3] . . . hct = m[,20] attach(m)