Read File in R Line by Line

The R code below reads a file line by line.

path <- "/path/to/the/file"
print(path)
 
conn <- file(path,open="r")
lines <- readLines(conn)
for (i in 1:length(lines)){
   print(lines[i])
}
close(conn)
Category >> R  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>