Re: [R-es] separadores de miles.

2021-10-14 Thread JCMld
Quizás podrías tener 2 columnas, una numérica sobre la que se base el gráfico y otra tipo carácter, con los separadores para cuando necesites usar esa presentación. Saludos, Juan De: juan manuel dias Enviado el: jueves, 14 de octubre de 2021 20:45 Para: JCMld CC: Lista R Asunto: Re:

Re: [R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Bert Gunter
This was already clear from Rich Heiberger's reply. But my point was not that the as.matrix() coercion was necessary, but that it would be wise, as operations with matrices are generally (often much) more efficient than with data frames. Of course, other considerations may exist, but that was my

Re: [R-es] separadores de miles.

2021-10-14 Thread juan manuel dias
Claro entiendo! ...en algunos casos pude guardar como character y mostrar la los números con los separadores, pero hay tablas donde necesito además de mostrar el número hacer un gráfico con esa misma variable...pero cuándo modifico a character "monto total de la factura" me arroja error porque no

Re: [R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Rui Barradas
Hello, The answer is given but there is no need to coerce to matrix first, as long as the columns are numeric. From ?exp, right at the beginning of section Details: Details All except logb are generic functions: methods can be defined for them individually or via the Math group generic.

Re: [R] [External] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Rui Barradas
Hello, exp() is better, see the 2nd identical: identical( exp(tmp), 2.718281828^tmp ) #[1] FALSE identical( exp(tmp), exp(1)^tmp ) #[1] FALSE all.equal( exp(tmp), 2.718281828^tmp ) #[1] TRUE all.equal( exp(tmp), exp(1)^tmp ) #[1] TRUE Às 18:16 de 14/10/21, Richard M.

Re: [R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Ana Marija
Thank you so much! On Thu, Oct 14, 2021 at 12:17 PM Bert Gunter wrote: > As all of your columns are numeric, you should probably convert your df to > a matrix. Then use exp() on that, of course: > exp(as.matrix(b)) > > see ?exp > > Bert Gunter > > "The trouble with having an open mind is that

Re: [R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Bert Gunter
As all of your columns are numeric, you should probably convert your df to a matrix. Then use exp() on that, of course: exp(as.matrix(b)) see ?exp Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in

Re: [R] [External] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Richard M. Heiberger
> tmp <- data.frame(a=1:3,b=4:6) > exp(tmp) a b 1 2.718282 54.59815 2 7.389056 148.41316 3 20.085537 403.42879 > 2.718281828^tmp a b 1 2.718282 54.59815 2 7.389056 148.41316 3 20.085537 403.42879 > On Oct 14, 2021, at 13:10, Ana Marija wrote: > >>

[R] how to do inverse log of every value in every column in data frame

2021-10-14 Thread Ana Marija
Hi All, I have a data frame like this: > head(b) LRET02LRET04LRET06LRET08LRET10LRET12LRET14 1 0 0.6931472 . 1.0986123 1.0986123 1.0986123 0.6931472 2 2.1972246 2.4849066 2.4849066 . 2.5649494 2.6390573 2.6390573 3 1.6094379 1.7917595 1.6094379

[R] Sebastian Meyer joins the R core team

2021-10-14 Thread Martin Maechler
We are very happy to announce that Sebastian Meyer (http://www.imbe.med.uni-erlangen.de/ma/S.Meyer ; Twitter @bastistician; also https://github.com/bastistician/) has joined the R core team yesterday (Oct 13). He has been an active contributor notably in handling and fixing R

Re: [R-es] separadores de miles.

2021-10-14 Thread JCMld
Hola Juan Manuel, Si el dato es numérico no puede guardarse con separadores, a no ser que lo convirtieras a character, ya que el separador es un tema de formato de salida. Entonces tienes 2 opciones, o lo guardas como numérico, pero a la hora de presentarlo lo imprimes con la función format, o

Re: [R-es] Eliminar todos los caracteres después de un espacio en blanco

2021-10-14 Thread juan manuel dias
Muy buena también! gracias Carlos! El mié, 13 oct 2021 a las 3:58, Carlos Ortega () escribió: > Hola, > > Aún cerrada la duda, dejo aquí otra posible alternativa: > > #--- > > > library(stringr) > > a <- c("7/6/2020 7:55:38 p.m.", "7/3/2020 1:08:36 p.m.", "7/3/2020 > 6:08:35 p.m.") >

[R-es] separadores de miles.

2021-10-14 Thread juan manuel dias
Hola. Como andan! Consulta, del siguiente data frame la columna "importe $" es de tipo numérico y querría que siga siendo numérica pero agregando separadores de miles. Proveedores`Importe en $` Porcentaje 1

Re: [R] How to find local minimum between distributions using mixtools?

2021-10-14 Thread Richard O'Keefe
I presumed there was some reason why the 'optimise' function did not suit you. optimize(function (x) a*dnorm(x, x1, s1) + (1-a)*dnorm(x, x2, s2), range(c(x1, x2))) should do the trick. On Thu, 14 Oct 2021 at 23:42, Luigi Marongiu wrote: > > Thank you, I hoped there might be an automatic method

Re: [R] How to find local minimum between distributions using mixtools?

2021-10-14 Thread Luigi Marongiu
Thank you, I hoped there might be an automatic method more than function analysis... On Thu, Oct 14, 2021 at 9:06 AM Richard O'Keefe wrote: > > Do you really want the minimum? > It sounds as though your model is a*N(x1,s1) + (1-a)*N(x2,s2) where > you use mixtools to estimate > the parameters.

Re: [R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Rui Barradas
Hello, If the sub-df has more than 2 rows, tail(df[(df$Y>0.2) & (df$X<10),], 1) Hope this helps, Rui Barradas Às 08:51 de 14/10/21, Luigi Marongiu escreveu: Hello, I have selected a subset of a dataframe with the vector syntax (if this is the name): ``` df[(df$Y>0.2) & (df$X<10),]

Re: [R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Luigi Marongiu
Got it, thanks! On Thu, Oct 14, 2021 at 9:59 AM Eric Berger wrote: > > df[(df$Y>0.2) & (df$X<10),][2,] > > On Thu, Oct 14, 2021 at 10:52 AM Luigi Marongiu > wrote: >> >> Hello, >> I have selected a subset of a dataframe with the vector syntax (if >> this is the name): >> ``` >> > df[(df$Y>0.2)

Re: [R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Eric Berger
df[(df$Y>0.2) & (df$X<10),][2,] On Thu, Oct 14, 2021 at 10:52 AM Luigi Marongiu wrote: > Hello, > I have selected a subset of a dataframe with the vector syntax (if > this is the name): > ``` > > df[(df$Y>0.2) & (df$X<10),] > YX > 10 0.2200642 1.591589 > 13 0.2941828

Re: [R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Andrew Simmons
You're missing a comma, this should fix it df[(df$Y>0.2) & (df$X<10),][2, ] On Thu, Oct 14, 2021, 03:51 Luigi Marongiu wrote: > Hello, > I have selected a subset of a dataframe with the vector syntax (if > this is the name): > ``` > > df[(df$Y>0.2) & (df$X<10),] > YX > 10

[R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Luigi Marongiu
Hello, I have selected a subset of a dataframe with the vector syntax (if this is the name): ``` > df[(df$Y>0.2) & (df$X<10),] YX 10 0.2200642 1.591589 13 0.2941828 1.485951 ``` How can I select only the second row? I only managed to get the whole of whole columns: ``` >

Re: [R] How to find local minimum between distributions using mixtools?

2021-10-14 Thread Richard O'Keefe
Do you really want the minimum? It sounds as though your model is a*N(x1,s1) + (1-a)*N(x2,s2) where you use mixtools to estimate the parameters. Finding the derivative of that is fairly straightforward calculus, and solving for the derivative being zero gives you extrema (you want the one between