• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: Tidyverse min{x, 1-x} by column

Resolved: Tidyverse min{x, 1-x} by column

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

My data is the following:
I would like to calculate 2 * min{x, 1-x} for each column.
In base R, I could do
but I struggle to find the tidyverse equivalent of this.
Expected result:

Answer:

A possible solution, using pmin (parallel min) to calculate the min rowwise:

If you have better answer, please add a comment about this, thank you!

r tidyverse
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Table data is coming as empty in React

02/04/2023

Resolved: In a Pinescript v5 Strategy why is my bool not working?

02/04/2023

Resolved: net::ERR_HTTP2_PROTOCOL_ERROR by http get request angular 15.2

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.