ScPoEcon / ScPoEconometrics

Undergraduate textbook for Econometrics with R
https://ScPoEcon.github.io/ScPoEconometrics/
Other
141 stars 68 forks source link

aboutApp() returns error message and doesn't open any file #106

Closed opmc2 closed 5 years ago

opmc2 commented 5 years ago

Hi Florian,

A number of students (and me!) are having issues with the command aboutApp(). launchApp() works fine.

I run the following command: aboutApp("reg_simple") And get the error:

Error: Please run aboutApp() with a valid app as an argument. Valid apps are: ''

Weirdly aboutApp() seems to work fine for Nicolo.

floswald commented 5 years ago

can you post please sessionInfo() after you see that behaviour?

floswald commented 5 years ago

I've just pushed a potential fix for this. can you give it a try by doing a reinstall of the package as described in chapter 1 of the book?

opmc2 commented 5 years ago

Sorry for all the edits---I reinstalled the package as you suggested and tried again and I get the same error. I have also posted the results of running sessionInfo() immediately after I get the error.

> aboutApp("reg_simple_arrows")

Error: Please run aboutApp() with a valid app as an argument. Valid apps are: ''

> sessionInfo()

R version 3.5.2 (2018-12-20) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: Fedora 29 (Workstation Edition)

Matrix products: default BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] usethis_1.4.0 devtools_2.0.1 dplyr_0.8.0.1 shiny_1.2.0
[5] ScPoEconometrics_0.2.1

loaded via a namespace (and not attached): [1] nlme_3.1-137 fs_1.2.6 lubridate_1.7.4 EnvStats_2.3.1 webshot_0.5.1
[6] httr_1.4.0 rprojroot_1.3-2 tools_3.5.2 backports_1.1.3 R6_2.3.0
[11] lazyeval_0.2.1 colorspace_1.4-0 withr_2.1.2 tidyselect_0.2.5 prettyunits_1.0.2 [16] processx_3.2.1 curl_3.3 compiler_3.5.2 cli_1.0.1 rvest_0.3.2
[21] xml2_1.2.0 desc_1.2.0 plotly_4.8.0 bookdown_0.9 scales_1.0.0
[26] mvtnorm_1.0-8 readr_1.3.1 callr_3.1.1 stringr_1.3.1 digest_0.6.18
[31] rmarkdown_1.11 jpeg_0.1-8 pkgconfig_2.0.2 htmltools_0.3.6 sessioninfo_1.1.1 [36] learnr_0.9.2.1 htmlwidgets_1.3 rlang_0.3.1 readxl_1.2.0 rstudioapi_0.9.0
[41] generics_0.0.2 jsonlite_1.6 magrittr_1.5 Ecfun_0.1-7 Matrix_1.2-15
[46] Rcpp_1.0.0 munsell_0.5.0 stringi_1.2.4 yaml_2.2.0 MASS_7.3-51.1
[51] pkgbuild_1.0.2 plyr_1.8.4 grid_3.5.2 promises_1.0.1 forcats_0.3.0
[56] crayon_1.3.4 lattice_0.20-38 haven_2.0.0 splines_3.5.2 hms_0.4.2
[61] knitr_1.21 ps_1.3.0 pillar_1.3.1 markdown_0.9 fda_2.4.8
[66] reshape2_1.4.3 pkgload_1.0.2 glue_1.3.0 evaluate_0.12 data.table_1.12.0 [71] remotes_2.0.2 modelr_0.1.2 httpuv_1.4.5.1 testthat_2.0.1 cellranger_1.1.0
[76] gtable_0.2.0 purrr_0.3.0 tidyr_0.8.2 assertthat_0.2.0 ggplot2_3.1.0
[81] TeachingDemos_2.10 xfun_0.4 mime_0.6 xtable_1.8-3 broom_0.5.1
[86] tidyverse_1.2.1 later_0.7.5 viridisLite_0.3.0 tibble_2.0.1 datasauRus_0.1.4
[91] memoise_1.1.0 Ecdat_0.3-1

opmc2 commented 5 years ago

I also had a look at your fix and then the function aboutApp() I have loaded and it doesn't seem to have applied your fix. I seem to have the latest version of the package from Github (see below).

> aboutApp

function (appname) { validExamples <- character(0) v <- list.files(system.file("shinys", package = "ScPoEconometrics"), full.names = TRUE) for (i in v) { if (file.exists(file.path(i, "about.Rmd"))) { validExamples <- c(validExamples, basename(i)) } } validExamplesMsg <- paste0("Valid apps are: '", paste(validExamples, collapse = "', '"), "'") if (missing(appname) || !nzchar(appname) || !appname %in% validExamples) { stop("Please run aboutApp() with a valid app as an argument.\n", validExamplesMsg, call. = FALSE) } appDir = system.file("shinys", appname, package = "ScPoEconometrics") rmarkdown::run(paste0(appDir, "/about.Rmd")) } <bytecode: 0xcdea288>

> library(devtools) > install_github(repo = "ScPoEcon/ScPoEconometrics")

Skipping install of 'ScPoEconometrics' from a github remote, the SHA1 (ac77c17e) has not changed since last install. Use force = TRUE to force installation

floswald commented 5 years ago

Yes that’s not my fix. Set force= T in that install call.

On Wed 6 Mar 2019 at 13:12, Oliver Cassagneau-Francis < notifications@github.com> wrote:

I also had a look at your fix and then the function aboutApp() I have loaded and it doesn't seem to have applied your fix. I seem to have the latest version of the package from Github (see below).

aboutApp

function (appname) { validExamples <- character(0) v <- list.files(system.file("shinys", package = "ScPoEconometrics"), full.names = TRUE) for (i in v) { if (file.exists(file.path(i, "about.Rmd"))) { validExamples <- c(validExamples, basename(i)) } } validExamplesMsg <- paste0("Valid apps are: '", paste(validExamples, collapse = "', '"), "'") if (missing(appname) || !nzchar(appname) || !appname %in% validExamples) { stop("Please run aboutApp() with a valid app as an argument.\n", validExamplesMsg, call. = FALSE) } appDir = system.file("shinys", appname, package = "ScPoEconometrics") rmarkdown::run(paste0(appDir, "/about.Rmd")) } <bytecode: 0xcdea288>

> library(devtools) > install_github(repo = "ScPoEcon/ScPoEconometrics") Skipping install of 'ScPoEconometrics' from a github remote, the SHA1 ( ac77c17 ) has not changed since last install. Use force = TRUE to force installation — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
opmc2 commented 5 years ago

Still get the same error but your fix has been applied.

> library(ScPoEconometrics)

Loading required namespace: shiny

> aboutApp("reg_simple_arrows")

Error: Please run aboutApp() with a valid app as an argument. Valid apps are: ''

> aboutApp

function (appname) { validExamples <- character(0) v <- list.files(system.file("shinys", package = "ScPoEconometrics"), full.names = TRUE) for (i in v) { if (file.exists(file.path(i, "about.Rmd"))) { validExamples <- c(validExamples, basename(i)) } } validExamplesMsg <- paste0("Valid apps are: '", paste(validExamples, collapse = "', '"), "'") if (missing(appname) || !nzchar(appname) || !appname %in% validExamples) { stop("Please run aboutApp() with a valid app as an argument.\n", validExamplesMsg, call. = FALSE) } appDir = system.file("shinys", appname, package = "ScPoEconometrics") rmarkdown::run(file = file.path(appDir, "about.Rmd")) } <bytecode: 0xbc8d298>

floswald commented 5 years ago

Ok.

Could you copy and paste the parts of the function into your r session?

Like what is v

What validExamples etc

Thanks

On Wed 6 Mar 2019 at 13:43, Oliver Cassagneau-Francis < notifications@github.com> wrote:

Still get the same error but your fix has been applied.

library(ScPoEconometrics)

Loading required namespace: shiny

aboutApp("reg_simple_arrows")

Error: Please run aboutApp() with a valid app as an argument. Valid apps are: ''

aboutApp

function (appname) { validExamples <- character(0) v <- list.files(system.file("shinys", package = "ScPoEconometrics"), full.names = TRUE) for (i in v) { if (file.exists(file.path(i, "about.Rmd"))) { validExamples <- c(validExamples, basename(i)) } } validExamplesMsg <- paste0("Valid apps are: '", paste(validExamples, collapse = "', '"), "'") if (missing(appname) || !nzchar(appname) || !appname %in% validExamples) { stop("Please run aboutApp() with a valid app as an argument.\n", validExamplesMsg, call. = FALSE) } appDir = system.file("shinys", appname, package = "ScPoEconometrics") rmarkdown::run(file = file.path(appDir, "about.Rmd")) } <bytecode: 0xbc8d298>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
opmc2 commented 5 years ago

I just looked at where the function is trying to find about.Rmd, so the path /home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_simple_arrows on my laptop, and the folder doesn't contain a file called about.Rmd.

On Nicolo's Mac the file is there but his ScPoEconometrics is in a different location and called ScPoEconometrics-master.

opmc2 commented 5 years ago

And to your comment: > v

[1] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/anscombe" [2] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/confidence_intervals" [3] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/corr_continuous" [4] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/datasaurus" [5] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/demeaned_reg" [6] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/estimate" [7] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/multicolinearity" [8] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_constrained" [9] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_dummy" [10] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_dummy_example" [11] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_full" [12] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_multivariate" [13] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_simple" [14] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_simple_arrows" [15] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_standardized" [16] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/Rescale" [17] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/sampling" [18] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/SSR_cone" [19] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/standard_errors_changeN" [20] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/standard_errors_simple"

While validExamples, even after running all the code in the function manually is: > validExamples

character(0)

floswald commented 5 years ago

Interesting.

I’ll have look later. I guess Nicolò did a direct download and not devtools like you. You could remove the package and install from scratch. Remove.packages is the function

On Wed 6 Mar 2019 at 13:59, Oliver Cassagneau-Francis < notifications@github.com> wrote:

And to your comment:

v

[1] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/anscombe" [2] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/confidence_intervals" [3] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/corr_continuous" [4] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/datasaurus" [5] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/demeaned_reg" [6] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/estimate" [7] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/multicolinearity" [8] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_constrained" [9] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_dummy" [10] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_dummy_example" [11] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_full" [12] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_multivariate" [13] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_simple" [14] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_simple_arrows" [15] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/reg_standardized" [16] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/Rescale" [17] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/sampling" [18] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/SSR_cone" [19] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/standard_errors_changeN" [20] "/home/opmc/R/x86_64-redhat-linux-gnu-library/3.5/ScPoEconometrics/shinys/standard_errors_simple"

While validExamples, even after running all the code in the function manually is:

validExamples

character(0)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ScPoEcon/ScPoEconometrics/issues/106#issuecomment-470097912, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-WduP7UrEC892tjYWA_znnyXIxuNo8ks5vT7ukgaJpZM4bbDiI .

floswald commented 5 years ago

hey, i think i found it - well not me, but #110 . so please can you reinstall and see if that changes anything?

opmc2 commented 5 years ago

Great. Both aboutApp() and runTutorial() are now working for me after reinstalling using install_github(). Thanks Florian, I'll tell my students!