Reputation: 5977
When I parse web sites in R, (system: R+debian) the html object output in the console make me uncomfortable.
The gap is wide between lines. How can I make it normal, to narrow the gap between the lines?
Maybe you can see tha same output with the following code.
options(encoding="gbk")
library(XML)
baseURL <- "http://www.jb51.net/article/27174.htm"
txt <- readLines(baseURL)
txt
Upvotes: 0
Views: 1019
Reputation: 89067
Interesting, it seems that when print
-ing a vector, the longest element decides how all elements will be spaced.
Your longest string is txt[374]
: on my screen, it takes 19 lines; that means every element of txt
will be printed using 19 lines, with possibly a lot of white space.
You don't have that problem when printing a list, so a solution is to do:
print(as.list(txt))
Upvotes: 1