Starting with creating our data file data.txt
:
12
54
7
332
54
1
0
We then write a short script to open the data file, loop over its lines and print each in-turn. The only thing that has been changed here is the argument being passed to file
:
lines <- readLines(file("data.txt"))
for (line in lines){
cat(line, sep="\n")
}
Rscript file.R
12
54
7
332
54
1
0