在r中找到多个rle的最大值

发布于 2025-02-03 19:32:11 字数 465 浏览 2 评论 0原文

我有一个看起来像这样的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小草泠泠 2025-02-10 19:32:11

所以我发现了解决方案!

我首先将它们变成媒介。然后使用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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文