How to access webpage from R - r

I am trying to access a webpage from R without any success -
> readLines('https://www.nseindia.com')
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") : InternetOpenUrl failed: 'The operation timed out'
Below is my session information-
> sessionInfo()
R version 4.0.1 (2020-06-06)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows Server x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] httr_1.4.1
loaded via a namespace (and not attached):
[1] compiler_4.0.1 R6_2.4.1 tools_4.0.1 curl_4.3
I am using R in Windows from Amazon AWS.
However when I use the same code from my local Mac, I have no problem.
Any pointer how to resolve this issue will be highly helpful.
Thanks,

setInternet2(TRUE)
Or try to run R in administrator mode.

Related

R: warning/error when calling normalizePath(...) or adding to .libPath(...)

I have a shared computer. If I login with windows userA, I can run the following:
normalizePath("//mydrive/my/path", "/")
and it returns:
"\\\\mydrive/my/path"
However if login to windows under userB, I get this message:
Warning message: In normalizePath(path.expand(path), winslash,
mustWork) : path[1]="//mydrive/my/path": An unexpected network
error occurred
What does it mean? This has important consequences, as it prevents to add "//mydrive/my/path" to the .libPaths() when running under userB, e.g .libPaths(new="//mydrive/my/path"), it prints the same warning, then as soon as I try to use a package that is in this lib location, it show the ERROR:
Error in normalizePath(path.expand(path), winslash, mustWork) :
path[1]="//mydrive/my/path": An unexpected network error occurred
Here are the details of my session under userA:
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2
Here are the details of my session under userB:
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2
Finally, I also noticed the following warning on userB, which could be linked to the same issue:
WARNING: You are configured to use the CRAN mirror at
https://cran.rstudio.com/. This mirror supports secure (HTTPS)
downloads however your system is unable to communicate securely with
the server (possibly due to out of date certificate files on your
system). Falling back to using insecure URL for this mirror.

igraph R - 'error in base'

I've recently updated my Windows machine and reinstalled R3.4.0 (64bit) and igraph 1.0.1. I've previously used igraph in combination with FCMapper and it's worked perfectly.
On the new machine I keep getting the following error, even with code that previously worked without a hitch:
Error in base::.Call("R_igraph_check_finally_stack", PACKAGE =
"igraph") : "R_igraph_check_finally_stack" not available for
.Call() for package "igraph"
Error in base::.Call(.NAME, ...) : "R_igraph_finalizer" not
available for .Call() for package "igraph"
I've had a google and the previous responses indicate that it's a NAMESPACE error in the current version of the package. Any help would be appreciated!
sessionInfo()
R version 3.4.0 (2017-04-21) Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale: [1] LC_COLLATE=English_United Kingdom.1252
LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United
Kingdom.1252 [4] LC_NUMERIC=C
LC_TIME=English_United Kingdom.1252
attached base packages: [1] stats graphics grDevices utils
datasets methods base
other attached packages: [1] igraph_1.0.1 FCMapper_1.1
loaded via a namespace (and not attached): [1] compiler_3.4.0
magrittr_1.5 tools_3.4.0

RSelenium issue with startServer() on windows

I just installed RSelenium from github (I have the same issue when I install it via cran) and I get the following error in windows machine:
Error in if (file.exists(file) == FALSE) if (!missing(asText) && asText == :
argument is of length zero
In addition: Warning message:
running command '"wmic" path win32_process get Caption,Processid,Commandline /format:htable' had status 44210
From the function startServer() this is the part that is producing the error:
system2("wmic", args = c("path win32_process get Caption,Processid,Commandline",
"/format:htable"), stdout = TRUE, stderr = NULL)
When I run this part I get the following:
character(0)
attr(,"status")
[1] 44210
Warning message:
running command '"wmic" path win32_process get Caption,Processid,Commandline /format:htable' had status 44210
My sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RSelenium_1.4.2 XML_3.98-1.4 RJSONIO_1.3-0 RCurl_1.95-4.8 bitops_1.0-6
loaded via a namespace (and not attached):
[1] httr_1.2.1 R6_2.1.2 tools_3.3.1 withr_1.0.1 curl_1.0 memoise_1.0.0 knitr_1.13 git2r_0.15.0
[9] caTools_1.17.1 digest_0.6.9 devtools_1.11.1
It is an issue with Win 7.
A htable XSL stylesheet is used to format the output of WMIC path win32_process
It results as a mismatch when using regional settings. Possible workarounds given are:
Copy or move the C:\Windows\system32\wbem\en-US*.xsl files up into the C:\Windows\system32\wbem\ folder.
Change your regional settings to match your Windows language version, log out and back in.
Specify the full path: WMIC process get /format:"%WINDIR%\System32\wbem\en-US\csv"
as noted in wmic error (invalid XSL format) in windows7

install_github R issue, SSL connect error

I am trying to install a package from github in R but am getting an error I havent been able to solve.
>devtools::install_github("hadley/multidplyr")
Downloading GitHub repo hadley/multidplyr#master
Error in curl::curl_fetch_memory(url, handle = handle) :
SSL connect error
This is on a 64bit Windows 7 enterprise machine. I tried to turn off verificaiton of the peer's ssl certificate with the following:
set_config( config( ssl_verifypeer = 0L ) )
This didn't change the error message unfortunately. Any help would be greatly appreciated.
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] httr_1.0.0
loaded via a namespace (and not attached):
[1] R6_2.1.1 magrittr_1.5 tools_3.2.2 curl_0.9.4
[5] memoise_0.2.1 stringi_1.0-1 stringr_1.0.0 digest_0.6.8
[9] devtools_1.9.1

remDr$open() Unexpected Error when using RSelenium with phantomjs

I am using the following code
remDr <- remoteDriver(browserName = "phantomjs")
URL <-"http://www.soccer24.com/kosovo/superliga/results/#"
remDr$open()
I get the following error:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.IllegalStateException
I don't know why am I getting the error?
My sessionInfo() result is below:
R version 3.0.3 (2014-03-06)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] R Selenium_1.3.5 RJSONIO_1.3-0 XML_3.98-1.1 RCurl_1.95-4.5 bitops_1.0-6
loaded via a namespace (and not attached):
[1] caTools_1.17.1 tools_3.0.3
And my java version is provided below for your reference:
system("java -version")
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)
It looks like you don't currently have the phantomjs.exe on your path. More details can be found in the RSelenium "Saucelabs" vignette http://cran.r-project.org/web/packages/RSelenium/vignettes/RSelenium-saucelabs.html#id2a.
So download phantomjs from here: http://phantomjs.org/download.html and put the exe in your path.

Resources