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 po

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. Fo

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. Heibe

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 pe

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 hi

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: > >> 2.718

[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] 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. F

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 1.48595

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 0

[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: ``` > df[(df

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