How to enable browserURL function when using `learnr` - r

I am using learnr to build up in-class slides held by shiny.io. The codes I would like to show includes some calling an external API. The file is smoothly compiled and uploaded to shiny.io. However, when I ran the codes through the shiny server, I got an error stating that
Cannot visit /tmp/RtmplHHftl/ID_20180123212516_1458.html because the browseURL function is disabled.
I searched online and found only one relevant post from Rstudio connect stating that the problem can be solved by using functions like shiny::tags$a function without any instruction about where and how to insert such functions.

Related

Run R.NET in and Azure Function

I am trying to integrate R into an Azure Function.
Instead of just calling the R exe - I want to be able to try the R.NET library to make it easier to pass and collect data between .NET and R. For example, respond to an event.
It runs fine locally, but once deployed as an Azure function, I get various errors. The latest ": This engine is not running. You may have forgotten to call Initialize"
For anyone else wanting to try this, I had to force the Azure function to run as 64bit, and also install the R extension library to the function. at RDotNet.REngine.CheckEngineIsRunning()
Has anyone had any success? Is anyone with R.NET experience wanting to help getting to work as an Azure function environment?
Looking at the code in R.NET for the functions RDotNet.REngine.GetInstance(), RDotNet.REngine.CheckEngineIsRunning(), and RDotNet.REngine.Initialize(), it appears as though creating the engine instance via RDotNet.REngine.GetInstance() should help you avoid this issue, as after calling that the method should be running, and you should not be encountering this area.
It is possible that you are encountering some error in creating this instance. Looking at the code comments about usage in the above link, it looks like an environment variable needs to be set for PATH. It is possible that the code you used to set this up does not work in Azure Functions. You can manually set environment variables in Azure Functions by using App Settings.

Can't get madlib.forest_train() in Rstudio by using PivotalR library

I have configured RStudio to run R code natively on Greenplum. I have searched online but I couldn't find answer to the problem I am facing at the moment.
I have imported the library(PivotalR) and library(RPostgreSQL). But, when I type madlib it just comes up with few of the functions:
The Greenplum database has also been configured with Madlib functions including madlib.forest_train, which does not show up in RStudio. I am assuming it has something to do with the PivotalR package for RStudio. Is there a way to make the forest_train work directly from RStudio?

r jug package not able to run, need local hosting of r functions

I'm trying to replicate the toy example found here:
https://www.r-bloggers.com/jug-easily-create-r-apis/
When I load the jug package, and run the script, my R console just seems to run continuously, thus I not able to attempt the second part of the code where I submit the curl request. I basically want to create a few functions that accept HTTP input, and host the functions locally. What am I missing?
See the screenshot image of my R console
Did you try going to http://127.0.0.1:8080? Do it while the script is running (as per your screenshot). It should prompt you the response of the function. In any case, I had similar issues with jug, so I recommend using plumber instead.

Rstudio outputs an error into the console while editing script

I am working on a project on Rstudio and something wired has become to happen: each time I write something into a script Rstudio automatically writes the following error into the console:
Error in rep.int(vectorNames[i], length(vector[[i]])) :
unimplemented type 'NULL' in 'rep3'
and a label appears under the cursor: "R code execution error".
Appart form this visual bug, everything is working properly. Does anyone have the same issue ?
I've just experienced this issue. In my case, I guess it must be related to the NAMESPACE file from the package.
I can see a discussion about this subject here on R Studio support site.
Citation from the source mentioned above:
There are two times when we run the code that could be emitting this error:
When attempting to retrieve completions from the package's NAMESPACE file,
When attempting to retrieve completions for native routines (e.g. for within a '.Call()' call).
Can you recall if you had been editing the package's NAMESPACE file before seeing this error? Alternatively, have you been using 'devtools::load_all()' or other similar machinery?
And to clearly answer your question:
Yes! I am having the same issue! (Damn it! :) )
LATER EDIT:
I've got rid of the problem by closing the project and reopening it again.

Error in Shiny in R when setting a ReferenceClass from a package loaded with devtools

This is a very specific question.
I have a simple Shiny app, using the latest version of R (3.2.2), RStudio (0.99.473), all packages up-to-date, tested in both Windows 7 and Ubuntu 14.04. The same thing happens in both SOs.
I have a library of functions which I embedded in a "package", with a properly created DESCRIPTION file. I use devtools to load this package. So, the first lines of code in my very simple Shiny app are
library("devtools")
load_all("../../RTEMP");
Since I plan to use some of these functions within the Shiny app. The package name is not actually RTEMP, I created this temporarily in order to isolate the problem. This temporary package has one single file inside RTEMP/R/, something.r. This file contains one line of code:
AA <- setRefClass("AA");
So I am creating a reference class with nothing but a name (my original code relies on R objects of this type). I am not doing anything with the package, simply loading it.
When running the Shiny app for the first time after opening RStudio, it works fine. If I close the app and open it again, I get the following error message:
ERROR: shinyjs: you cannot mix named and unnamed arguments in the same function call
Curiously, if I change the beginning of my Shiny app to this:
#library("devtools")
#load_all("../../RTEMP");
AA <- setRefClass("AA");
So, commenting the package loading and setting the reference class inside the Shiny app, everything works fine.
The problem happens when I call setRefClass from within a package loaded with devtools, but not when I call it directly from Shiny. Also, I can load it the first time, but not the second (the Shiny Window simply shows the error message above).
Any ideas what may be causing this bug?
Thank you very much.
It is actually a problem in the devtools package that is causing incompatibility with shinyjs. I submited this bug report and hopefully this will not happen in the next versions.
If you experienced a similar error message with Shiny, there might be other functions in other packages (or in your own package) that needs the namespace.

Resources