Skip to content

Commit c38fdb3

Browse files
authored
Merge pull request #442 from tcuongd/tcuongd-knitr-deps-fix
Check for knitr installation before loading env
2 parents ff832c8 + 313020e commit c38fdb3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

R/zzz.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ cmdstanr_knitr_env <- cmdstanr_knitr_env_function_generator(new.env())
7373
}
7474

7575
.onLoad <- function(...) {
76-
cmdstanr_knitr_env(knitr::knit_global())
76+
if (requireNamespace("knitr", quietly = TRUE)) {
77+
cmdstanr_knitr_env(knitr::knit_global())
78+
}
7779
cmdstanr_initialize()
7880
}

0 commit comments

Comments
 (0)