我正在尝试使用R中的readLines()函数读取url的html内容.但是,我收到一条"incomplete final line found"警告消息,如下所示?在这种情况下如何跳过最后一行?任何建议将非常感谢.
x <- readLines("https://in.finance.yahoo.com/industries/technology")
Warning message:
In readLines("https://in.finance.yahoo.com/industries/technology") :
incomplete final line found on 'https://in.finance.yahoo.com/industries/technology'
Run Code Online (Sandbox Code Playgroud)
Chr*_* S. 12
大多数文件缺少行尾标记,如下面的新行,所以我只使用warn = FALSE.
cat("abc\ndef\nhij", file="test.txt")
readLines( "test.txt")
# [1] "abc" "def" "hij"
# Warning message:
# In readLines("test.txt") : incomplete final line found on 'test.txt'
readLines( "test.txt", warn=FALSE)
# [1] "abc" "def" "hij"
Run Code Online (Sandbox Code Playgroud)