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

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 oftxtwill 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: