lines = 'iq_change group_number 3 1 2 1 6 1 10 1 10 1 5 1 10 2 4 2 11 2 14 2 3 2 20 3 9 3 18 3 19 3' con = textConnection( lines ) DF = read.table( con, header=TRUE ) close(con)