Re: [ESS] unexpected behavior for Emacs-27.1-1-modified-1 for two MacBooks.

2021-01-27 Thread Dirk Eddelbuettel via ESS-help
On 26 January 2021 at 18:59, Dirk Eddelbuettel via ESS-help wrote: | | On 26 January 2021 at 22:07, Stephen Berman via ESS-help wrote: | | > I. Both machines report in *Messages* | | >Package cl is deprecated | | | | The NEWS file in Emacs 27 says: | | | | ** The 'cl' package is now

Re: [ESS] Next steps [OT] Best Practices Emacs / ESS Mini-Webinars

2021-01-27 Thread Liz Hare via ESS-help
Hello, Going back to our earlier conversation about ensuring the accessibility of Mini Webinars, I'm able to share MiR's Accessibility Workbook (attached). This is of particular interest to blind R users because the RStudio IDE is not an option for us due to its inaccessibility. Please let me

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Bill Dunlap
I tried the following change, that adds quotes if the argument does not include ">". Index: front-ends/rcmdfn.c === --- front-ends/rcmdfn.c (revision 79883) +++ front-ends/rcmdfn.c (working copy) @@ -173,9 +173,13 @@

Re: [ESS] unexpected behavior for Emacs-27.1-1-modified-1 for two MacBooks.

2021-01-27 Thread Richard M. Heiberger via ESS-help
For completeness: I decided to stay with aspell. simply because that (60.6 from 2014) is what I had been using,. I downloaded hombrew and had it install the newer aspell 60.8 (2019). Just four lines and now M-x ispell works. /bin/bash -c "$(curl -fsSL

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Duncan Murdoch
On 27/01/2021 3:40 p.m., Bill Dunlap wrote: I believe the problem is from svn 77925 in gnuwin/front-ends/rcmdfn.c, which was committed a few days after 3.6.3 was released. Rterm used to put double quotes around a command line argument only if it contained a space, now it double quotes all

Re: [R] Get 3 values not only 1

2021-01-27 Thread jim holtman
Is this what you are after? You need to store a vector in the list: > > # Data > PIB.hab<-c(12000,34000,25000,43000,12500,32400,76320,45890,76345,90565,76580,45670,23450,34560,65430,65435,56755,87655,90755,45675) >

Re: [R] Get 3 values not only 1

2021-01-27 Thread Jim Lemon
Hi varin, How about this: Mbv<-data.frame(MSE=rep(NA,1000), biais=rep(NA,1000),variance=rep(NA,1000)) for(i in 1 :1000) { n<-dim(Dataset)[1] p<-0.667 sam<-sample(1 :n,floor(p*n),replace=FALSE) Training <-Dataset [sam,] Testing <- Dataset [-sam,] fit2<-lm(PIB.hab~ISQ.2018)

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Bill Dunlap
I believe the problem is from svn 77925 in gnuwin/front-ends/rcmdfn.c, which was committed a few days after 3.6.3 was released. Rterm used to put double quotes around a command line argument only if it contained a space, now it double quotes all arguments. It sees shell constructs like "1>" and

[R] Get 3 values not only 1

2021-01-27 Thread varin sacha via R-help
Dear R-experts, Here below my R code working but I would like to get 3 values not only 1. The value I get is, according to my R code, the variance value. My goal is to get 3 values : the bias value, the variance value and the MSE value. How to solve my problem ? Many thanks.

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Duncan Murdoch
On 27/01/2021 3:17 p.m., Duncan Murdoch wrote: On 27/01/2021 3:38 a.m., Martin Maechler wrote: Martin Maechler on Tue, 26 Jan 2021 12:37:58 +0100 writes: Marcel Baumgartner on Tue, 26 Jan 2021 08:55:48 +0100 writes: >> Dear all, my colleague posted our issue on

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Duncan Murdoch
On 27/01/2021 3:38 a.m., Martin Maechler wrote: Martin Maechler on Tue, 26 Jan 2021 12:37:58 +0100 writes: Marcel Baumgartner on Tue, 26 Jan 2021 08:55:48 +0100 writes: >> Dear all, my colleague posted our issue on stackoverflow: >> Calling R script from Python does not

Re: [R] random numbers with constraints

2021-01-27 Thread Abby Spurdle
I note that there's a possibility of floating point errors. If all values have one digit after the decimal point, you could replace: qexp (p, rate) with round (qexp (p, rate), 1). However, sometimes uniroot will fail, due to problems with input. On Thu, Jan 28, 2021 at 5:02 AM Denis Francisci

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Bill Dunlap
I mistyped, 3.6.3 omits "1>", "log.txt" (not arguments.txt"), etc. My test was run in C:\tmp and used -e instead of -f and bin/R.exe instead of bin/x64/R.exe, using the following python script: import subprocess cmd363 = " ".join(["C:/R/R-3.6.3/bin/R.exe", "--vanilla", "--quiet", #

Re: [R-es] Crear Cluster

2021-01-27 Thread l.graco--- via R-help-es
clustMixType no es una función, es un paquete de R que implementa el algoritmo k-prototypes en R. Este es un algoritmo similar la k-means pero válido para tipos de datos mixtos. El paquete incluye no solo métodos para la determinación de clústeres sino también para el cálculo de índices de

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Bill Dunlap
Note that in R-3.6.3 commandArgs() does not include the arguments intended to be processed by the shell, "1>", "arguments.txt", etc., but in R-4.0.3 it does include them. It is as though an R shell() command was replaced by a system() command so cmd.exe didn't get a chance to process the command

[R-es] Crear Cluster

2021-01-27 Thread ricardo alva
Hola amigos. Soy algo nuevo en este tema de R, pero estoy aprendiendo a empujones porque el tiempo apremia. Necesito segmentar 165000 personas con los siguientes datos, los cuales los tengo en excel en un archivo llamado Data, el cual tiene la siguiente forma. Nombre G�nero EdadR_Edad

Re: [R] create

2021-01-27 Thread Bert Gunter
Thanks for the reprex. I think this is one way to do what you want: dt$flag2 <- 0 + with(dt,Item == "DESK" & check %in% code2) > dt$flag2 <- 0 + with(dt,Item == "DESK" & check %in% code2) > dt name Item check flag2 1A DESK NORF 0 2B RANGE GARRA 0 3C CLOCK PALM 0

[R] create

2021-01-27 Thread Val
Hi all, I have a sample of data as shown below, dt <-read.table(text="name Item check A DESK NORF B RANGE GARRA C CLOCKPALM D DESK RR E ALARMDESPRF H DESK RF K DESK CORR K WARF CORR G NONE RF ",header=TRUE, fill=T) I want create another

Re: [R] problem when loading tidyverse

2021-01-27 Thread Carlos Gonzalez
Many thanks, Jeff. Very clear El mié, 27 de ene. de 2021 a la(s) 14:29, Jeff Newmiller ( jdnew...@dcn.davis.ca.us) escribió: > These are not errors, they are informational, and the Posting Guide points > out that details of how to use contributed packages such as tidyverse are > off topic (too

Re: [R-es] resultados de un apply

2021-01-27 Thread Manuel Mendoza
Gracias Marcelino, tomo nota para la próxima vez que me haga falta. Manuel El mié, 27 ene 2021 a las 8:07, Marcelino de la Cruz Rot (< marcelino.delac...@urjc.es>) escribió: > Perdón, > > preds <- colnames(probs)[apply(probs, 1, which.max)] > > El 27/01/2021 a las 7:57, Marcelino de la Cruz Rot

Re: [R] problem when loading tidyverse

2021-01-27 Thread Jeff Newmiller
These are not errors, they are informational, and the Posting Guide points out that details of how to use contributed packages such as tidyverse are off topic (too many of them for one list). If you want to use the versions of the functions that tidyverse is overriding, specify the desired

[R] problem when loading tidyverse

2021-01-27 Thread Carlos Gonzalez
Why when loading tidyverse shows the following: -- Conflicts -- tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag()masks stats::lag() -- Saludos / Regards Carlos A. Gonzalez Mobile +598 94 234 653 cag...@gmail.com

Re: [R] Is there anyone who uses both R and Python here? How do you debug? Perhaps in RStudio?

2021-01-27 Thread Spencer Graves
You can mix R and Python code in the same R Markdown vignette. See: https://bookdown.org/yihui/rmarkdown/language-engines.html ```{r "RcodeChunk"} # R code ``` ```{python "PythonCodeChunk"} # Python code ``` I did this a couple of years ago. I haven't used Python since. However, this

Re: [R] Is there anyone who uses both R and Python here? How do you debug? Perhaps in RStudio?

2021-01-27 Thread Robert Knight
An iterative process works well. Python to get the data desired and then Rscript script.r from a command line. My process involves building a script in R using, using Rstudio, Pycharm, VS Code, Kate, or some other editor. Then using data input built with Python as input to Rscript. The R

Re: [R] random numbers with constraints

2021-01-27 Thread Denis Francisci
Wonderful! This is exactly what I need! Thank you very much!! Denis Il giorno mer 27 gen 2021 alle ore 10:58 Abby Spurdle ha scritto: > u <- runif (410) > u <- (u - min (u) ) / diff (range (u) ) > > constrained.sample <- function (rate) > { plim <- pexp (c (9.6, 11.6), rate) > p <-

Re: [R] problem installing R and RStudio

2021-01-27 Thread Carlos Gonzalez
Thank you @LucyNjoki!!! Everything runs ok now. El mar, 26 de ene. de 2021 a la(s) 16:51, John Kane (jrkrid...@gmail.com) escribió: > A couple of Window solutions > >

Re: [R] How to predict/interpolate new Y given knwon Xs and Ys?

2021-01-27 Thread Luigi Marongiu
Thank you for the clarification. On Wed, Jan 27, 2021 at 3:32 PM Jeff Newmiller wrote: > > Your piecewise-linear function Y(X) is not invertible as a whole so there is > no general solution per algebra. > > You keep saying predict can do this, but as I pointed out and Rui ventured to > expand

Re: [R] How to predict/interpolate new Y given knwon Xs and Ys?

2021-01-27 Thread Jeff Newmiller
Your piecewise-linear function Y(X) is not invertible as a whole so there is no general solution per algebra. You keep saying predict can do this, but as I pointed out and Rui ventured to expand the math on, predict cannot calculate an inverse even if you swap the inputs. And as Abby pointed

Re: [ESS] unexpected behavior for Emacs-27.1-1-modified-1 for two MacBooks.

2021-01-27 Thread Kasper Daniel Hansen via ESS-help
Regarding cl: On top of replacing (require 'cl) with (require 'cl-lib) I also needed to make a number of changes to the usage of various cl functions. Emacs would complain about unknown functions once I did (require 'cl-lib). Basically all of the cl functions were changed from XX to cl-XX for

Re: [R] How to predict/interpolate new Y given knwon Xs and Ys?

2021-01-27 Thread Luigi Marongiu
That is right, I removed the points above 39, and also got 16.60964, which looks good to me. Splines is good and I will use it for non-linear interpolation. For now I used linear conversion to keep it simple but looks to me it is getting out of hand. I simply need to do the following

Re: [R] How to predict/interpolate new Y given knwon Xs and Ys?

2021-01-27 Thread Abby Spurdle
I got 16.60964. Your curve is not linear up to the 39th point. And as your points appear to be deterministic and nonlinear, splines are likely to be easier to use. Here's a base-only solution (if you don't like my kubik suggestion): g <- splinefun (X, Y) f <- function (x) g (x) - 6 uniroot (f, c

Re: [R] random numbers with constraints

2021-01-27 Thread Abby Spurdle
u <- runif (410) u <- (u - min (u) ) / diff (range (u) ) constrained.sample <- function (rate) { plim <- pexp (c (9.6, 11.6), rate) p <- plim [1] + diff (plim) * u qexp (p, rate) } diff.sum <- function (rate) sum (constrained.sample (rate) ) - 4200 rate <- uniroot (diff.sum, c (1,

Re: [R] random numbers with constraints

2021-01-27 Thread Ralf Goertz
Am Wed, 27 Jan 2021 09:03:15 +0100 schrieb Denis Francisci : > Hi, > I would like to generate random numbers in R with some constraints: > - my vector of numbers must contain 410 values; > - min value must be 9.6 and max value must be 11.6; > - sum of vector's values must be 4200. > Is there a

Re: [R] How to predict/interpolate new Y given knwon Xs and Ys?

2021-01-27 Thread Luigi Marongiu
Dear Jeff, I am not sure if I understood the procedure properly but it looks like it works: ``` Y <-c(1.301030, 1.602060, 1.903090, 2.204120, 2.505150, 2.806180, 3.107210, 3.408240, 3.709270, 4.010300, 4.311330, 4.612360, 4.913390, 5.214420, 5.515450, 5.816480, 6.117510, 6.418540,

Re: [ESS] unexpected behavior for Emacs-27.1-1-modified-1 for two MacBooks.

2021-01-27 Thread Stephen Berman via ESS-help
On Tue, 26 Jan 2021 18:59:27 -0600 Dirk Eddelbuettel via ESS-help wrote: > On 26 January 2021 at 22:07, Stephen Berman via ESS-help wrote: > | > I. Both machines report in *Messages* > | >Package cl is deprecated > | > | The NEWS file in Emacs 27 says: > | > | ** The 'cl' package is now

Re: [R] Error when calling (R 4.0.x on Windows) from Python

2021-01-27 Thread Martin Maechler
> Martin Maechler > on Tue, 26 Jan 2021 12:37:58 +0100 writes: > Marcel Baumgartner > on Tue, 26 Jan 2021 08:55:48 +0100 writes: >> Dear all, my colleague posted our issue on stackoverflow: >> Calling R script from Python does not save log file in >>

[R] random numbers with constraints

2021-01-27 Thread Denis Francisci
Hi, I would like to generate random numbers in R with some constraints: - my vector of numbers must contain 410 values; - min value must be 9.6 and max value must be 11.6; - sum of vector's values must be 4200. Is there a way to do this in R? And is it possible to generate this series in such a