R Kernel using scale function -> Rich Error
Hello,
I'm using R in my jupyter notebook, which works like a charm except for using the function scale(x) which gives me the following failure
ERROR while rich displaying an object: Error: cols >= 2L is not TRUE
Traceback:
1. FUN(X[[i]], ...)
2. tryCatch(withCallingHandlers({
. if (!mime %in% names(repr::mime2repr))
. stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
. rpr <- repr::mime2repr[[mime]](obj)
. if (is.null(rpr))
. return(NULL)
. prepare_content(is.raw(rpr), rpr)
. }, error = error_handler), error = outer_handler)
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. doTryCatch(return(expr), name, parentenv, handler)
6. withCallingHandlers({
. if (!mime %in% names(repr::mime2repr))
. stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
. rpr <- repr::mime2repr[[mime]](obj)
. if (is.null(rpr))
. return(NULL)
. prepare_content(is.raw(rpr), rpr)
. }, error = error_handler)
7. repr::mime2repr[[mime]](obj)
8. repr_text.ts(obj)
9. repr_ts_generic(obj, repr_text, "%s:\n%s", ...)
10. repr_func(vec, ..., rows = nrow(vec), cols = ncol(vec), caption_override = "Time Series")
11. repr_text.matrix(vec, ..., rows = nrow(vec), cols = ncol(vec),
. caption_override = "Time Series")
12. ellip_limit_arr(obj, rows, cols)
13. arr_partition(a, rows, cols)
14. stopifnot(rows >= 2L, cols >= 2L)
15. stop(msg, call. = FALSE, domain = NA)
I've found that the rich issues related to repr so I've tried to install the newest version from github with the following command
devtools::install_github('IRkernel/repr')
but this does not fix it. What could be the problem?
Thank you
This happens here:
https://github.com/IRkernel/repr/blob/e82a31920376d42bf2545584dd07a4c2f8370768/R/repr_matrix_df.r#L35-L36
which is called here:
https://github.com/IRkernel/repr/blob/e82a31920376d42bf2545584dd07a4c2f8370768/R/repr_matrix_df.r#L105-L110
which in turn is only ever called with cols = getOption('repr.matrix.max.cols'), so probably that option somehow manages to be set to a value ≤1.
can you confirm? and if yes, please figure out why that is. the default set by repr is 20, so you (or some code you call into) must have set it somewhere…
https://github.com/IRkernel/repr/blob/e82a31920376d42bf2545584dd07a4c2f8370768/R/options.r#L72