'In the dataframe Error replacing values in all columns using ifelse
In a dataframe, I want to convert a negative number to an absolute value and multiply it by 100 for a positive number.
r
a b c
0.6 0 -0.1
0 -0.2 0.3
r %>% mutate(across(function(x) ifelse(x<0,-x,x*100)))
I get an error.
I want output
r a b c
60 0 0.1
0 0.2 30
thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
