[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:10:12 CEST 2021


Hi All,

I have a data frame like this:

> head(b)
     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]]



More information about the R-help mailing list