R web scraping in Azure ML errors out - r

I have written a script in RStudio (running R 3.5.2) that scrapes data from a particular website. The script reaches out to a website, uses download.file to pull the underlying code, and uses tags to extract the desired data.
The script runs without error in RStudio, but when I try to run the code in the "Execute R Script" node in Azure ML it throws a 0063 error saying that it "cannot reach URL ". The code runs perfectly up until it tries to reach out to the URL. (see code below)
I have tried switching the R version in Azure ML--neither of the 3 options work.
for(a in 1:length(job_url)) {
download.file(url, destfile = filename, quiet=TRUE)
...
}
I expect the script to run the same in RStudio and Azure ML. Any ideas how to get this script to run in Azure ML the same way it runs in RStudio?

For security reasons, all networking from or to R code in Execute R Script modules is blocked by Azure.
https://learn.microsoft.com/en-us/azure/machine-learning/studio-module-reference/execute-r-script#networking

Related

How to setup a secure code evaluator in LearnR like rstudio.cloud does?

When we use the self-hosted version of Learn R or hosted version in shinyapps.io, the user can print out variables that contain the tutorial source code using the code evaluator.
For example in shinyapps hosted version, the user can run .server_context to get the source code of the current rmd:
(UPDATED) Example 2:
By running cat(system("cat /srv/connect/apps/ex-data-filter/ex-data-filter.Rmd", intern = TRUE), sep = '\n') can to get the source code of the current rmd too:
But interestingly in rstudio.cloud hosted version, the code evaluator seems to be sandboxed, and all "sensitive" variables cannot be run through the evaluator.
Can I get some advice on how to implement such a secure code evaluator?
Thanks!

How to execute an R shiny script from the command line

I've created a single R file 'myfile.R' which is composed of several functions, reading from an odbc connection, and of course the ui and server components for the shiny application. The goal is for the user to treat this as an executable, that is, I'd like them to be able to run this app without having to run Rstudio. Currently on this environment, Rstudio is installed (as are the relevant packages), what I'm currently writing in command line is:
Rscript myfile.R
The file looks to be successfully loaded, but the application itself does not 'pop up' towards me, infact nothing does, it just says that it is listening on http....
I was thinking of creating a bash script that could do this, and this seemed to be the most simple approach but this is not working.

Can no longer save R/RStudio scripts on OneDrive - Windows

R version: 4.0.3
RStudio version: 1.3
Windows 10, 1909
At my work I have to use OneDrive to store all my files and R scripts. This has worked fine up until recently. Now I get an error message when trying to save or modify an R script. I can create a new script and save it once, but if I try to make changes and save it again the error prevents me from doing so.
The error message in RStudio is:
"The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached"
Not the most helpful error message.
The same behavior happens in R itself, but the error message just says it cannot save.
I have seen some talk online about this being related to that latest Windows 10 version (1909), but I started to experience the issue about 2 weeks before my computer updated to 1909. Besides, my work will not allow a roll back to the previous version.
Microsoft's OneDrive team failed to provide any help on this because they see it as an error on the R/RStudio side.
Anyone else experiencing this? Any solution?

R integration in Tableau Online v9

I'm a trying to publish my tableau 9 workbook into tableau online.
The problem is that I have integrated some R script in my workbook. It's working fine on my desktop and I have install Rserve.
When I try to publish (on tableau online) it return this error:
An unexpected error occurred. If you continue to receive this error please contact your Tableau Server Administrator.
TableauException: No Rserve connection configured.
Do you know how we can make it work with tableau Online (not server)
R connections are not supported in Tableau Public and Tableau Online. Reference the R implementations notes at http://kb.tableau.com/articles/knowledgebase/r-implementation-notes.

Pass R object to R batch process?

I would like to pass a PostgreSQL connection object (which is an RObject) to a batch process. Is this possible at all?
Why am I trying to do this?
I had trouble running a script that sources another script on R Studio Server. The script itself runs fine without the other script sourcing it. So this is clearly an R Studio Server Web Interface issue. However I am trying to circumvent the issue by just triggering a batch from R Studio server, after I used its nice .rs.askForPassword function that ships with Rstudio. I tried to following but couldn't get it to work cause to connection always ending up being expired when it was used from the batch.
# run file
save(con,file="conObj.Rdata")
system("R CMD batch.R") # also tried Rscript
batchfile looks like this
# batch file
load("conObj.Rdata")
#.... run some db query #
save("someObjFromDb","test.Rdata")
This breaks because of an expired connection object.

Resources