gadenbuie / xaringanthemer

😎 Give your xaringan slides some style

Home Page:https://pkg.garrickadenbuie.com/xaringanthemer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue installing 0.2.0 from github

techisdead opened this issue · comments

Hi,

I'm getting an error when I try installing from github. Here's the installation output in a clean Rstudio session (running ubuntu 18.04)

> devtools::install_github("gadenbuie/xaringanthemer")
Downloading GitHub repo gadenbuie/xaringanthemer@master
✓  checking for file ‘/tmp/Rtmp3tVsn2/remotes275a2d6f0f6f/gadenbuie-xaringanthemer-460f441/DESCRIPTION’ ...
─  preparing ‘xaringanthemer’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘xaringanthemer_0.2.0.tar.gz’
   
Installing package into ‘/home/starkie/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package ‘xaringanthemer’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error : Assigned data `vars[var]` must be compatible with existing data.
ℹ Error occurred for column `default`.
x No common type for `value` <character> and `x` <list>.
Error: unable to load R code in package ‘xaringanthemer’
Execution halted
ERROR: lazy loading failed for package ‘xaringanthemer’
* removing ‘/home/starkie/R/x86_64-pc-linux-gnu-library/3.6/xaringanthemer’
Error: Failed to install 'xaringanthemer' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmp3tVsn2/file275a12fa6648/xaringanthemer_0.2.0.tar.gz’ had non-zero exit status

My session info:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
 [5] LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8    LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        rstudioapi_0.10   magrittr_1.5      usethis_1.5.1     devtools_2.2.1    pkgload_1.0.2    
 [7] R6_2.4.1          rlang_0.4.5       fansi_0.4.1       tools_3.6.1       pkgbuild_1.0.6    sessioninfo_1.1.1
[13] cli_2.0.2         withr_2.1.2       ellipsis_0.3.0    remotes_2.1.0     assertthat_0.2.1  digest_0.6.25    
[19] rprojroot_1.3-2   crayon_1.3.4      processx_3.4.1    callr_3.4.1       fs_1.3.1          ps_1.3.0         
[25] curl_4.3          testthat_2.3.1    memoise_1.1.0     glue_1.3.2        compiler_3.6.1    desc_1.2.0       
[31] backports_1.1.5   prettyunits_1.1.1

I've previously installed an used it on a number of platforms. Any idea what could be stopping it this time?

If not I can fork it and see what I find.

The issue is specifically this line - tv[tv$variable == var, 'default'] <- vars[var]

set_default <- function(tv, ...) {
  vars <- c(...)
  for (var in names(vars)) {
    tv[tv$variable == var, 'default'] <- vars[var]
  }
  tv
}

where it's trying to assign a 'character' to a 'list'

where the 'list' is introduced because of these NULL values

-https://github.com/gadenbuie/xaringanthemer/blob/master/R/theme_settings.R#L40
-https://github.com/gadenbuie/xaringanthemer/blob/master/R/theme_settings.R#L46
-https://github.com/gadenbuie/xaringanthemer/blob/master/R/theme_settings.R#L50

when doing the various do.call('rbind', list()) on the templates.


If you change those three NULLs to NA_character_ then the error goes away. But I haven't confirmed / tested if it breaks the templates or not.

Which at first glance I think is caused by the breaking changes to tibble 3.0.0

And since this package isn't on CRAN it didn't get flagged in any reverse dependency checks.

Thank you both for the issue report and the investigation. It turns out the fix was to replace with "{NULL}" (because those strings pass through glue() when they're used to write the theming functions). In retrospect, I was definitely cutting corners here and I'm surprised this used to work.

The fix is in the dev branch for v0.3.0 (which I'm hoping to merge to master and send to CRAN soon). Check out the NEWS for a quick intro to updates and changes, which should mostly be seamless.

remotes::install_github("gadenbuie/xaringanthemer@dev")