相同的网页抓取代码在Windows和Linux R上给出不同的结果

我正在从URL中提取一些数据。首先,我尝试使用R版本3.6.0在Windows上执行此操作,并且工作正常。但是,当我使用R版本3.4.4在linux上运行相同的代码时,提取表中的文本还有其他几个字符,例如“ text ..”。

在linux R上,提取的片段中的两个点显示为空格。但是,当我尝试从linux R复制文本并将其粘贴在Windows R上时,显示为红色的两个点。

library(XML)
library(RCurl)
library(rlist)
library(stringr)

theurl <- getURL("URL",.opts = list(ssl.verifypeer = FALSE) )
tables <- readHTMLTable(theurl)
tables <- list.clean(tables,fun = is.null,recursive = FALSE)
n.rows <- unlist(lapply(tables,function(t) dim(t)[1]))
a<-tables[[which.max(n.rows)]]

head(a,4)

在Windows上输出

>   Details   Date
> 1   text1   30-10-2019
> 2   text2   27-10-2019
> 3   text3   12-10-2019
> 4   text4   05-10-2019

在Linux上的Outpu(两个点在linux上不显示,只有粘贴在Windows R上才可见)

>   Details     Date
> 1   text1..   30-10-2019
> 2   text2..   27-10-2019
> 3   text3..   12-10-2019
> 4   text4..   05-10-2019

这可能是什么原因?

ssd88 回答:相同的网页抓取代码在Windows和Linux R上给出不同的结果

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3161986.html

大家都在问