I tried to knit my R markdown document in to flex dashboard but I keep getting the following error when trying to import 'shap' package in python chunk of code:
Quitting from lines 45-46 [unnamed-chunk-1] (working_example.Rmd)
Error:
! RuntimeError: ValueError: Key figure.figsize: Could not convert [6.0, 3.75] to float
Backtrace:
1. rmarkdown::render(...)
2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3. knitr:::process_file(text, output)
7. knitr:::process_group.block(group)
8. knitr:::call_block(x)
...
12. knitr (local) engine(options)
13. reticulate::eng_python(options)
14. reticulate:::py_compile_eval(snippet, compile_mode)
17. builtins$eval(compiled, globals, locals)
18. reticulate:::py_call_impl(callable, dots$args, dots$keywords)
Execution halted
The line 45-46 contains the python chunk which imports shap library.
I am sure this has something to do with shap library since I don't get such error with other libraries. I tried to import the shap library in a new document and it did not cause any problem.
UPDATE: It seems that changing the R Markdown output to html_document solves the issue. I suspect the error might be caused by flexdashboard.
It seems the issue is fixed in newer version of reticulate, flexdashboard or rmarkdown libraries. Updating the libraries solves the problem.