msening
msening

Reputation: 53

Find max value for multiple rle in r

I have a list of RLEs that looks like this:

RleList of length 3
$item1
  Lengths:   1   3   1   2   1   5
  Values :  NA   0   4  13  14  17

$item2
  Lengths:   4   1   1   1   1   1   1   1   1   1
  Values :   0  18 102 108 131 167 181  48  31  29

$item3
  Lengths:   1   3   1   1   1   1   1   1   1   1   1
  Values :   0   1  20  56  65  77 106  50  47  44   7

I used it to make a plot that has multiple lines in one plot. I want to find a line of maximum values of the 3 lines and plot that into a new plot. How can I achieve my goal? Do I need to convert the RLE to a vector and then find the max values for each position?

Upvotes: 0

Views: 122

Answers (1)

msening
msening

Reputation: 53

So I found out the solution!

I first turned them into vectors. And then used pmax to find the pairwise max for all of them!

This post helped a lot!

Upvotes: 0

Related Questions