1

I'm running some code in a .Rmd file using M-n v u, but when I do so, my output is truncated. I'd like to turn this feature off, but the only documentation I can find mentioning truncation is for ess-eldoc-abbreviation-style and it's related to the mini-buffer.

Here's an example of what happens. Code

while(my.round <= max.round){

input.restart.file <- paste0(output.dir,"Restart/rstart.round.", my.round - 1, ".rst")
output.restart.file <- paste0(output.dir,"Restart/rstart.round.", my.round, ".rst")

    
if(my.round==1){ #initial set up
    ## Initialize parameter object
    ## Set initial phi value
    parameter <-
        initializeParameterObject(
        genome = genome,
        model = which.model,
        sphi = init_sphi,
        mutation.prior.mean = mutation.prior.mean,
        mutation.prior.sd = mutation.prior.sd, ## should try changing this
        num.mixtures = 1,
        gene.assignment = rep(1, genome.length),
        split.serine = TRUE,
        mixture.definition = mixDef)
    divergence.iteration <- initial.divergence
.
.
.

R Window in Emacs

+ while(my.round <= max.round){
+ 
+     input.restart.file <- paste0(output.dir,"Restart/rstart.round.", my.round - 1, ".rst")
+     output.restart.file <- paste0(output.dir,"Restart/rstart.round.", my.round, ".rst")
+ 
+     
+ if(my.round==1){ #initial set up
+     ## Initialize parameter object.... [TRUNCATED] 

UPDATE: I've now downloaded a copy of the emacs source code and searched for "[TRUNCATED]" and get nothing.

I've also searched my .emacs folders and get the same results.

For what it's worth, I'm running

  1. Ubuntu-Mate 20.04
  2. GNU Emacs 26.3
  • (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian
  1. ESS version 18.10.2
2
  • This option is likely from R, not from Emacs. Are you using knitr? It can be configured to do this. Commented Nov 8, 2021 at 20:58
  • OMG! Thanks for pointing out this obvious alternative explanation! I am using knitr, but can't find any direct documentation on this. This posting about the Tinn-R console stackoverflow.com/a/55292384 suggests it is related to a source() command option max.deparse.length. I will investigate further. Commented Nov 10, 2021 at 2:17

1 Answer 1

1

So it looks like I need to figure out how to modify the options ESS sends to R using .ess.source() and .ess.eval(). Specifically, I need to change the argument

max.deparse.length: integer; is used only if ‘echo’ is ‘TRUE’ and gives
      the maximal number of characters output for the deparse of a
      single expression.

I can do this including the following in the source file I'm working with.

library(default)
default(.ess.source) <- list(max.deparse.length=1E5)
default(.ess.eval) <- list(max.deparse.length=1E5)

(NB: it doesn't work in my .Rprofile because R doesn't know about these libraries until they are some how loaded by emacs-ESS.)

1
  • It looks like I want to set max.depare.lengt = echo() rather than an integer. The relevant code seems to be in: ess/etc/ESSR/R/.basic.R: Specifically, .ess.eval <- function(string, visibly = TRUE, output = FALSE, max.deparse.length = 300, file = tempfile("ESS"), local = NULL) { and .ess.source <- function(file, visibly = TRUE, output = FALSE, max.deparse.length = 300, local = NULL, fake.source = FALSE, keep.source = TRUE, message.prefix = "") { Commented Oct 25, 2022 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.