Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (latest_R_version == R_version) { : argument is of length 0 #152

Open
biosol opened this issue May 19, 2020 · 10 comments
Open

Comments

@biosol
Copy link

biosol commented May 19, 2020

Hi everyone,
I'm trying to include R in my shiny app but I get this error message:

Error in if (latest_R_version == R_version) { : argument is of length 0

I'm calling:
create_app(app_name = "myApp", app_dir = "myShinyApp", pkgs = c("shiny","data.table", "ggplot2", "dplyr",), include_R = TRUE)

And my session info is:
R version 3.6.3 (2020-02-29) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 10 x64 (build 18362)

I've also tried putting R-3.6.3-win.exe inside the folder with my server.R and ui.R files without success... has anyone faced the same issue?? Thanks a lot in advanced!

@statisticsguru1
Copy link

I am facing this issue and can't get a work around, did you solve it?

@biosol
Copy link
Author

biosol commented May 27, 2020

No... not really... have you tried putting the R executables in your app folder? It might work for you...

@statisticsguru1
Copy link

Nope, I, i am not sure where i should exactly place that, is it on the bin folder??

@statisticsguru1
Copy link

I was looking at this website; https://rdrr.io/cran/RInno/man/create_app.html.
the default R version is the R version you're using, i.e
paste0(">=", R.version$major, '.', R.version$minor)

funny enough using
include_R = TRUE,
R_version="2.2.1")

knows that the version is not supported

Error: R_version (2.2.1) <= 3.0.2 is not supported.

@lucassilvat
Copy link

I don't know if anyone answered this but I got a fix by doing this:

trace(get_R,edit=T)

Then you should change this part of the code:

latest_R_version <- readLines("https://cran.rstudio.com/bin/windows/base/", warn = F) %>% stringr::str_extract("[1-3]\\.[0-9] \\.[0-9] ") %>% stats::na.omit() %>% unique()

It looks at cran for the latest version, but it only accounts for versions between 1 and 3 (the latest is R-4.0.1 for Windows). Therefore, just change 3 for 4, save it and you should be OK.

This solution is temporary. Expect doing this everytime you restart a R Session or just change it from the source version of the package.

Since it is a simple solution, maybe RInno's maintainers had already fixed it in the most up-to-date version.

@statisticsguru1
Copy link

super!! i spend my whole weekend searching the get_R file from the R inno package files.
you saved me

@roman-tremmel
Copy link

roman-tremmel commented Aug 26, 2020

I was running into the same problem using RInno_1.0.1 from Cran (e.g. install.packages(RInno)) . I had to replace the 3 with the 4 in the trace(RInno::get_R,edit=T) but also in the trace(RInno::code_section,edit=T) to succesfully compile the app.

@brandonerose
Copy link

brandonerose commented Feb 21, 2022

Via roman-tremmel. I created a fork that does this so I don't need to keep editing it. Found at Git hub "brandonerose/RInno"

@vekinoir
Copy link

vekinoir commented Jan 4, 2024

I am facing the same error with create_app with argument include_R = TRUE, R_version = "4.0.0"

Error in if (latest_R_version == R_version) { : 
  argument is of length zero

However when I change the 3 to 4 in the latest_R_version in trace(RInno::get_R,edit=T) and trace(RInno::code_section,edit=T)

I am still getting an error

Error in if (latest_R_version == R_version) { : 
  the condition has length > 1

How to fix this?

@Jurassic-Raccoon
Copy link

I am still getting an error

Error in if (latest_R_version == R_version) { : 
  the condition has length > 1

How to fix this?

latest_R_version is a vector containing several values, which explains the error in the condition.
To fix this, add the index of the first value in the condition (with trace(RInno::get_R,edit=T)) :
if (latest_R_version[1] == R_version)
instead of :
if (latest_R_version == R_version)

This works for me, but the problems come later. Can you tell me if you succeed to generate a stand-alone application?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants