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] 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] 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

[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