Install a CRAN package for a learnr tutorial

36 views
Skip to first unread message

Dimitris Rizopoulos

unread,
Aug 22, 2017, 2:21:51 PM8/22/17
to Shiny - Web Framework for R
I'm trying to install one of my packages (JM), which is available on CRAN (https://cran.r-project.org/package=JM) for a learnr tutorial. In the beginning of the tutorial I have the code:

```{r setup, include=FALSE}
library("learnr")
library("survival")
library("lattice")
library("JM")
data("
aids.id", package = "JM")
knitr::opts_chunk$set(echo = FALSE)
```


This works of course fine in my machine, but when I try to deploy the tutorial on shinyapps.io the package does not seem to get installed and the tutorial does not work. Should I make the requirement for JM evident in some other way in order for rsconnect
to pick it up?

Thanks in advance for any pointers!

Best,
Dimitris

Joe Cheng [RStudio]

unread,
Aug 22, 2017, 8:13:26 PM8/22/17
to Shiny - Web Framework for R
That's strange, library(JM) should be enough. Any error messages during deployment?

Dimitris Rizopoulos

unread,
Aug 23, 2017, 3:13:57 AM8/23/17
to Joe Cheng [RStudio], Shiny - Web Framework for R
Yes, I get the error:

Error: Unable to retrieve package records for the following packages:
- "JM"
Execution halted


My minimal example is an .Rmd file with the following content:

<begin Rmd>

---
title: "Tutorial"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library("learnr")
library("JM")
data("aids.id", package = "JM")
knitr::opts_chunk$set(echo = FALSE)
```

## Topic 1

### Exercise

Write the R code required to add two plus two:

```{r two-plus-two, exercise=TRUE}

```

<end Rmd>

> 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 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] Rcpp_0.12.11 withr_1.0.2 digest_0.6.12 rprojroot_1.2
mime_0.5 R6_2.2.2 xtable_1.8-2
[8] jsonlite_1.5 backports_1.1.0 magrittr_1.5 evaluate_0.10.1
stringi_1.1.5 learnr_0.9 rmarkdown_1.6
[15] tools_3.4.0 stringr_1.2.0 htmlwidgets_0.8 markdown_0.8
shiny_1.0.3 rsconnect_0.8 httpuv_1.3.5
[22] yaml_2.1.14 compiler_3.4.0 htmltools_0.3.6 knitr_1.16



Best,
Dimitris


On 8/23/2017 2:13 AM, Joe Cheng [RStudio] wrote:
> That's strange, library(JM) should be enough. Any error messages during
> deployment?
>
> On Tuesday, August 22, 2017 at 11:21:51 AM UTC-7, Dimitris Rizopoulos wrote:
>
> I'm trying to install one of my packages (JM), which is available on
> CRAN (https://cran.r-project.org/package=JM
> <https://cran.r-project.org/package=JM>) for a learnr
> <https://cran.r-project.org/package=learnr> tutorial. In the
> beginning of the tutorial I have the code:
>
> |
> ```{r setup, include=FALSE}
> library("learnr")
> library("survival")
> library("lattice")
> library("JM")
> data("aids.id <http://aids.id/>", package = "JM")
> knitr::opts_chunk$set(echo = FALSE)
> ```
> |
>
>
> This works of course fine in my machine, but when I try to deploy
> the tutorial on shinyapps.io <http://shinyapps.io> the package does
> not seem to get installed and the tutorial does not work. Should I
> make the requirement for JM evident in some other way in order for
> rsconnect
> to pick it up?
>
> Thanks in advance for any pointers!
>
> Best,
> Dimitris
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Shiny - Web Framework for R" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/shiny-discuss/BxnPOTfKcoM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> shiny-discus...@googlegroups.com
> <mailto:shiny-discus...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/shiny-discuss/8a8c2018-9c51-4ab0-8deb-598fe31edcaa%40googlegroups.com
> <https://groups.google.com/d/msgid/shiny-discuss/8a8c2018-9c51-4ab0-8deb-598fe31edcaa%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Winston Chang

unread,
Aug 23, 2017, 3:49:14 PM8/23/17
to Dimitris Rizopoulos, Joe Cheng [RStudio], Shiny - Web Framework for R
I'm not able to reproduce the problem using your sample document. It deploys fine for me:

I also added a code block that calls sessionInfo(), and here's what I get:

## R version 3.4.1 (2017-06-30)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS Sierra 10.12.6
## 
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] splines   stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
## [1] JM_1.4-7        survival_2.41-3 nlme_3.1-131    MASS_7.3-47    
## [5] learnr_0.9      shiny_1.0.4    
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.12    knitr_1.17      magrittr_1.5    xtable_1.8-2   
##  [5] lattice_0.20-35 R6_2.2.2        stringr_1.2.0   tools_3.4.1    
##  [9] grid_3.4.1      withr_2.0.0     htmltools_0.3.6 yaml_2.1.14    
## [13] rprojroot_1.2   digest_0.6.12   Matrix_1.2-10   htmlwidgets_0.9
## [17] evaluate_0.10.2 mime_0.5        rmarkdown_1.6   stringi_1.1.5  
## [21] compiler_3.4.1  backports_1.1.0 jsonlite_1.5    httpuv_1.3.5   
## [25] markdown_0.8


To unsubscribe from this group and all its topics, send an email to shiny-discuss+unsubscribe@googlegroups.com <mailto:shiny-discuss+unsubscri...@googlegroups.com>.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/ce0f3d99-cf21-df0e-a31f-ff0394f9ce4e%40gmail.com.

Joe Cheng

unread,
Aug 23, 2017, 4:56:32 PM8/23/17
to Winston Chang, Dimitris Rizopoulos, Shiny - Web Framework for R
This error:

Error: Unable to retrieve package records for the following packages:

- "JM"

usually means you've installed a package in a way that rsconnect (actually packrat) can't tell where it came from. Most commonly, it means you ran R CMD INSTALL locally (or equivalent, like Build in an RStudio package project). You can fix this by installing using install.packages or devtools::install_github, and deploying again.

To unsubscribe from this group and all its topics, send an email to shiny-discus...@googlegroups.com <mailto:shiny-discus...@googlegroups.com>.

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.

Dimitris Rizopoulos

unread,
Aug 24, 2017, 5:19:46 AM8/24/17
to Joe Cheng, Winston Chang, Shiny - Web Framework for R
That was the problem! Thanks for the pointer!

Best,
Dimitris
> <mailto:dimitris....@gmail.com>> wrote:
>
> Yes, I get the error:
>
> Error: Unable to retrieve package records for the following
> packages:
> - "JM"
> Execution halted
>
>
> My minimal example is an .Rmd file with the following content:
>
> <begin Rmd>
>
> ---
> title: "Tutorial"
> output: learnr::tutorial
> runtime: shiny_prerendered
> ---
>
> ```{r setup, include=FALSE}
> library("learnr")
> library("JM")
> data("aids.id <http://aids.id>", package = "JM")
>     data("aids.id <http://aids.id> <http://aids.id/>",
> package = "JM")
>     knitr::opts_chunk$set(echo = FALSE)
>     ```
>     |
>
>
>     This works of course fine in my machine, but when I try
> to deploy
>     the tutorial on shinyapps.io <http://shinyapps.io>
> <http://shinyapps.io> the package does
>     not seem to get installed and the tutorial does not
> work. Should I
>     make the requirement for JM evident in some other way
> in order for
>     rsconnect
>     to pick it up?
>
>     Thanks in advance for any pointers!
>
>     Best,
>     Dimitris
>
> --
> You received this message because you are subscribed to a
> topic in the Google Groups "Shiny - Web Framework for R" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/shiny-discuss/BxnPOTfKcoM/unsubscribe.
> To unsubscribe from this group and all its topics, send an
> email to shiny-discus...@googlegroups.com
> <mailto:shiny-discuss%2Bunsu...@googlegroups.com>
> <mailto:shiny-discus...@googlegroups.com
> <mailto:shiny-discuss%2Bunsu...@googlegroups.com>>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/shiny-discuss/8a8c2018-9c51-4ab0-8deb-598fe31edcaa%40googlegroups.com
> <https://groups.google.com/d/msgid/shiny-discuss/8a8c2018-9c51-4ab0-8deb-598fe31edcaa%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
>
> You received this message because you are subscribed to the
> Google Groups "Shiny - Web Framework for R" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to shiny-discus...@googlegroups.com
> <mailto:shiny-discuss%2Bunsu...@googlegroups.com>.
>
> To view this discussion on the web visit
Reply all
Reply to author
Forward
0 new messages