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

Ana Marija @okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Thu Oct 14 19:23:40 CEST 2021

```Thank you so much!

On Thu, Oct 14, 2021 at 12:17 PM Bert Gunter <bgunter.4567 using gmail.com> 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 people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Oct 14, 2021 at 10:10 AM Ana Marija <sokovic.anamarija using gmail.com>
> wrote:
>
>> Hi All,
>>
>> I have a data frame like this:
>>
>>      LRET02    LRET04    LRET06    LRET08    LRET10    LRET12    LRET14
>> 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 1.7917595 2.0794415 1.9459101 2.0794415
>> 4         0         0         0         0         0         0         0
>> 5 0.6931472         0 1.0986123 1.0986123 0.6931472 0.6931472 0.6931472
>> 6 1.0986123 1.0986123 1.0986123 0.6931472 1.0986123 1.3862944 1.0986123
>>
>> All values in this data frame are product of natural log. I have to do
>> inverse of it.
>> So for example do do inverse of 0.6931472 I would do:
>> > 2.718281828^0.6931472
>> [1] 2
>>
>> How do I perform this operation for every single value in this data frame?
>>
>> The original data frame is this dimension:
>> > dim(b)
>> [1] 1441   18
>>
>> Thanks
>> Ana
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help