[ESS] ESS[SAS]: experience, fixes, and starting questions
Hello, I've used ESS with R before, but I just started with using it for SAS and I had an initial experience that I'm unsure is due to my lack of knowledge (and lack of proper understanding of the documentation) or more related with the status of the SAS support in ESS. I'm using Emacs 30.0.6, with ESS installed through package.el (ess-20240122.1720). SAS is SAS 9.4, locally installed in Debian GNU/Linux (symlinked to /usr/local/bin/sas). My remarks are mostly about the iESS approach, which is what I was after. My initial experience with it was that a substantial part of it didn't work out of the box: opening a test.sas file puts the file in SAS mode (this part works), but anything that starts the interactive session (M-x SAS, C-RET, C-z) hangs after splitting the screen in the different horizontal buffers. Changing some things (like the inferior-ess-program) give slightly different results, but only superficially: the SAS process never starts, and each time an evaluation is attempted a new set of buffers gets created. My first question is about this experience: is my environment ill-configured and/or did sidestep some obvious setup, or is the SAS support known to be in need of some care? The reason I ask is also because I went digging around the code, and some things are hard for me to understand: 1. "ess-sas-sh-command" is defined as the value for "inferior-SAS-command" in the ess-SAS-pre-run-hook, but in my testing (and for reasons I haven't yet fully explored) it doesn't seem to get to SAS(), which will uses the "default" inferior-ess-process. 2. Assuming that "ess-sas-sh-command" is the way to go, SAS() currently doesn't pass any arguments to (inferior-ess ...); this breaks the ess-sas-sh-command script that expects the ptys for stdout and stderr. 3. The "ess-sas-goto*" family doesn't work as is, since from what I was able to discover, it tries to go after a "test.log" and "test.lst" file being visited, but AFAIK the *SAS.log* and *SAS.lst* buffers use the redirection from the ess-sas-sh-command. These commands are used by others, and specifically by ess-sas-graph-view. Some other small things are also strange, e.g. the SAS keymap doesn't seem to be activated (F12 is not assigned to ess-sas-graph-view, for example). I'm certainly missing lots of context here, so take the above as an innocent attempt at trying to solve things. The good news is that after "solving" the above (in a very quick and dirty way), iESS with SAS works as I would expect: * Interactive development works perfectly, with output going to the log and list buffers. * I can use the graph view to open the last (ODS) plot created. Additionally, I've started to experiment with the LSP server that SAS built for the vscode extension, with encouraging results; this image shows the completion-at-point behaviour: https://i.imgur.com/HdpzCy7.png I'm going to explore things a bit more, eventually get into polyline and using something like Rmd/Rnw but with SAS (through SASmarkdown or something else), but wanted to get the "base" environment stable first. Best regards, Frederico Muñoz __ ESS-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help
Re: [R] DescTools::Quantile
On 26/01/2024 10:38 a.m., Michael Meyer via R-help wrote: Greetings, I am having a problem with DescTools::Quantile (a function computing quantiles from weighted samples): # these sum to one probWeights = c( 0.0043, 0.0062, 0.0087, 0.0119, 0.0157, 0.0204, 0.0257, 0.0315, 0.0378, 0.0441, 0.0501, 0.0556, 0.06, 0.0632, 0.0648, 0.0648, 0.0632, 0.06, 0.0556, 0.0501, 0.0441, 0.0378, 0.0315, 0.0257, 0.0204, 0.0157, 0.0119, 0.0087, 0.0062, 0.0043 ) x = seq(-100,100,length.out=length(probWeights)) qtls <- DescTools::Quantile(x, weights=probWeights, probs=c(0.1,0.9)) cat("\nQuantiles:\n") print(qtls) Both quantiles are equal to 100! Is this function working or am I not using it correctly? There's an obvious bug in that function: n <- sum(weights) # this sets n to 1 in your data ord <- 1 + (n - 1) * probs # This sets ord to c(1,1) low <- pmax(floor(ord), 1) high <- pmin(low + 1, n) ord <- ord%%1 allq <- approx(cumsum(weights), x, xout = c(low, high), method = "constant", f = 1, rule = 2)$y k <- length(probs) qs <- (1 - ord) * allq[1:k] + ord * allq[-(1:k)] This bug was reported on the package website 6 months ago (https://github.com/AndriSignorell/DescTools/issues/123), and hasn't been addressed. I'd suggest the best action is to find a different package. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.