在r中找到多个rle的最大值
我有一个看起来像这样的RLE的列表:
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
我用它制作了一个图中有多行的图。我想找到一条3行的最大值线,并将其绘制到一个新图中。我该如何实现自己的目标?我是否需要将RLE转换为向量,然后找到每个位置的最大值?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我发现了解决方案!
我首先将它们变成媒介。然后使用
pmax
为所有这些找到成对的最大值!this
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!