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

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Thu Oct 14 20:27:27 CEST 2021


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. Heiberger escreveu:
>> 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 <sokovic.anamarija using gmail.com> wrote:
>>
>>> 2.718281828^
> 
> ______________________________________________
> R-help using 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.
>



More information about the R-help mailing list