setwd("mydir") dtb <- read.table(file="test.txt",header = TRUE) ar.ols(x=dtb[2:6966,],demean=FALSE,intercept = TRUE, prewhite=TRUE)