Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R Kernel using scale function -> Rich Error #131

Open
rednag opened this issue Jun 26, 2020 · 1 comment
Open

R Kernel using scale function -> Rich Error #131

rednag opened this issue Jun 26, 2020 · 1 comment
Labels
needs info The reported information is incomplete

Comments

@rednag
Copy link

rednag commented Jun 26, 2020

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

@flying-sheep
Copy link
Member

flying-sheep commented Jun 30, 2020

This happens here:

repr/R/repr_matrix_df.r

Lines 35 to 36 in e82a319

arr_partition <- function(a, rows, cols) {
stopifnot(rows >= 2L, cols >= 2L)

which is called here:

repr/R/repr_matrix_df.r

Lines 105 to 110 in e82a319

ellip_limit_arr <- function(
a,
rows = getOption('repr.matrix.max.rows'),
cols = getOption('repr.matrix.max.cols')
) {
parts <- arr_partition(a, rows, cols)

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…

repr.matrix.max.cols = 20L,

@flying-sheep flying-sheep added the needs info The reported information is incomplete label Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info The reported information is incomplete
Projects
None yet
Development

No branches or pull requests

2 participants