我正在从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
这可能是什么原因?