I have a dataframe like this:
DATE | CZK | EUR | USD |
---|---|---|---|
2021-07-25 | 25 | 15,5555684 | 4 |
And I want to turn it into this table:
DATE | CP | mnozstvi |
---|---|---|
2021-07-25 | CZK | 25 |
2021-07-25 | EUR | 15,5555684 |
2021-07-25 | DOL | 4 |
My data.frame is much larger, this is just minimal example. I seek some versatile solution. I managed to do that by function gather() like this:
data.frame %>% gather(CP,,CZK,EUR,USD) %>% rename(mnozstvi = value)
But it changed the numbers as some of them vere decimal adn I dnt know why. Any ideae how to do that easily? thank you.