Can't publish markdown to Rpub on Windows - r

After compile the R Markdown document with knitr package in html file, I tried to push to RPub with the "Publish" bottom. However, I am getting error as:
"Error in function (type, msg, asError = TRUE) :
SSL certificate problem: unable to get local issuer certificate
Calls: rpubsUpload ... -> .postForm -> .Call -> -> fun
Execution halted"
I am using windows RStudio Version 0.98.1091.I am assuming it is because windows to Rpub connection configuration issue.
First time using the Rpub. Could you help where to config the SSL certificate on windows? Thanks.

Under preferences in Rstudio, there is a tab "git/SVN".
Have you created an "RSA" key?
This can be done through github.
See https://help.github.com/articles/generating-ssh-keys/

Related

R CMD check fails with ubuntu when trying to download file, but function works within R

I am writing an R package and one of its functions download and unzips a file from a link (it is not exported to the user, though):
download_f <- function(download_dir) {
utils::download.file(
url = "https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php",
destfile = file.path(download_dir, "fines.rar"),
mode = 'wb',
method = 'libcurl'
)
utils::unzip(
zipfile = file.path(download_dir, "fines.rar"),
exdir = file.path(download_dir)
)
}
This function works fine with me when I run it within some other function to compile an example in a vignette.
However, with R CMD check in github action, it fails consistently on ubuntu 16.04, release and devel. It [says][1]:
Error: Error: processing vignette 'IBAMA.Rmd' failed with diagnostics:
cannot open URL 'https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php'
--- failed re-building ‘IBAMA.Rmd’
SUMMARY: processing the following file failed:
‘IBAMA.Rmd’
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.
When I run devtools::check() it never finishes running it, staying in "creating vignettes" forever. I don't know if these problems are related though because there are other vignettes on the package.
I pass the R CMD checks with mac os and windows. I've tried switching the "mode" and "method" arguments on utils::download.file, but to no avail.
Any suggestions?
[1]: https://github.com/datazoompuc/datazoom.amazonia/pull/16/checks?check_run_id=2026865974
The download fails because libcurl tries to verify the webservers certificate, but can't.
I can reproduce this on my system:
trying URL 'https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php'
Error in utils::download.file(url = "https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php", :
cannot open URL 'https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php'
In addition: Warning message:
In utils::download.file(url = "https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php", :
URL 'https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php': status was 'SSL peer certificate or SSH remote key was not OK'
The server does not allow you to download from http but redirects to https, so the only thing to do now is to tell libcurl to not check the certificate and accept what it is getting.
You can do this by specifying the argument -k to curl
download_f <- function(download_dir) {
utils::download.file(
url = "https://servicos.ibama.gov.br/ctf/publico/areasembargadas/downloadListaAreasEmbargadas.php",
destfile = file.path(download_dir, "fines.rar"),
mode = 'wb',
method = 'curl',
extra = '-k'
)
utils::unzip(
zipfile = file.path(download_dir, "fines.rar"),
exdir = file.path(download_dir)
)
}
This also produces some download progress bar, you can silence this by setting extra to -k -s
This now opens you up to a Machine In The Middle Attack. (You possibly already are attacked this way, there is no way to check without verifying the current certificate with someone you know at the other side)
So you could implement an extra check, e.g. check the sha256sum of the downloaded file and see if it matches what you expect to receive before proceeding.
myfile <- system.file("fines.rar")
hash <- sha256(file(myfile))

Unable to Knit HTML /PDF/Word in R Studio(Version 0.98.1103). Encountering "Execution Halted"

I was working on R markdown documents in R studio, and I had knit the HTML, PDF and Word. It had worked fine.
Then when I tried to publish it online I encountered an error
" Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate Calls: rpubsUpload ... -> .postForm -> .Call -> -> fun Execution halted"
To solve which I had found a solution at " https://support.rstudio.com/hc/en-us/articles/205002917-SSL-certificate-problem-when-publishing-to-RPubs" which suggested running the command
file.edit('~/.Rprofile') within RStudio
and inserting the following code:
options(rpubs.upload.method = "internal" .
But after doing the above, I have not been able to knit any thing in R Studio.
Every time I click Knit button I keep encountering
"Error: could not find function "file.edit"
Execution halted"
How can I resolve this and get things to work?
I have finally found the solution. I simply found where my .Rprofile was and deleted it. It solved my problem.

The app is disconnected after a second

I ran shiny app in linux.
I open the browser in the url: http://192.241.147.231:4949/sample-apps/MonitorUI/
The page is open but after a second disconnected.
I check the log file and it write to me this massage:
Error in eval(expr, envir, enclos) :
You are attempting to load an rmarkdown file, but the
rmarkdown package was not found in the library. Ensure that
rmarkdown is installed and is available in the Library of the
user you're running this application as.
Calls: local -> eval.parent -> eval -> eval -> eval -> eval
Execution halted
I already downloaded the "rmarkdown" package. and it updated.
What is the problem? i don't find anything for this problem in the web.
the sample app that given by shiny-server package:http://192.241.147.231:4949/sample-apps/hello/ is working so what is the problem?
Thanks.

R Markdown RPubs error

I followed the steps outlined in https://blog.safaribooksonline.com/2014/01/29/rstudio-r-markdown-r-scripts-rpubs/
but encounter error as in Can't publish markdown to Rpub on Windows
Step 1:
install.packages('knitr', dependencies = TRUE)
Step 2:
library('knitr')
Step 3:
File-> New File-> R Markdown.
Key in Title, Author, and choose HTML radio button.
Some template appear..
Step 4:
Click knit HTML button
Step 5:
I create a free account by visiting www.rpubs.com.
Step 5:
Click Publish.
Once you click the publish button you will be prompted to login with your RPubs account. --> I do not have this...
But I have error:
"Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate Calls: rpubsUpload ... -> .postForm -> .Call -> -> fun Execution halted"
Boniface Osonwanne's answer at https://support.rstudio.com/hc/communities/public/questions/202496207-Difficulties-in-publishing-R-presentation-in-RPubs worked for me with a little tweaking.
To summarize, he said open up the following directory:
C:\Program Files\R\R-3.1.2\library\base\R
Then add the following line using Notepad on line 25.
options(rpubs.upload.method = "internal")
Notepad made a mess of the file for me, but Notepad++ worked fine.
My problem came in when I tried to save. Even though I had just rebooted and didn't have R or Rstudio open, I couldn't save. I copied the file to my desktop made the edit there and copied the file back with administrator permissions.
When I started R and knitted my Rmd, it worked like a charm.

rbundler build error: "cannot open file 'startup.Rs': No such file or directory"

I'm running into an issue when building the following package: https://github.com/yoni/rbundler
My test attempts to run rbundler's bundle command on a trivial package which has a single dependency. The test passes on my OSX machine, but fails on my x86_64-redhat-linux-gnu Jenkins server. Both machines are running R 2.15.1 with devtools 0.7.1, which includes this bug fix.
The full test output can be found in this gist.
Here's a short summary of error I'm seeing:
Error in file(filename, "r", encoding = encoding) :
cannot open the connection
Calls: local ... eval.parent -> eval -> eval -> eval -> eval -> source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
cannot open file 'startup.Rs': No such file or directory
Execution halted
The background for this is that I'm trying to build a dependency management system for R. The idea is that an R project should be able to run without using system-wide or user-wide libraries. Rather, the R project will have it's own library installed under it's root directory.
For my previous Stack Overflow question related to Dependency Management in R, see Dependency management in R
In my case this issue was caused by the environment variable R_TESTS that was set to startup.Rs
When you execute another R process from within your tests (in my case it was submitted via OGS qsub), the presence of this environment variable causes issues.
I can't answer your question directly, but two things you can try get more information about what is happening.
use 'env' to dump environment variables on your OSX machine and the Jenkins host
run the process through strace on Linux and dtruss on OSX to trap the system calls
strace/dtruss should reveal the places in which it is searching for startup.Rs and env output will likely give you a environment variable that differs between the system accounting for the different outcome.

Resources