小编Xan*_*n97的帖子

如何将数据帧的两行合并为一行?

基本上,我有一个简单的两列数据帧,一个以 10° 为间隔的圆度数,另一个在不同的数据帧中具有这些度数的频率。

In the degrees column there is a row for 0° and a row for 360°, and since those mean the same thing (in the context of wind direction) I'd like to combine the two rows into a single 0° row. E.g. from:

degree   freq 
0        1446
10       7652
20       2655
...
360      5417
Run Code Online (Sandbox Code Playgroud)

To this

degree   freq 
0        6863
10       7652
20       2655
...
Run Code Online (Sandbox Code Playgroud)

I'm sure this a very simple thing to do but I've spent 3 …

r

1
推荐指数
1
解决办法
41
查看次数

如何计算跨列的连续值

在 R 中,我有一个如下所示的数据框:

        2021    2020    2019    2018    2017    2015    2010    2006    2002    1998    1994    1990
1       6       6       6       6       4       6       6       6       6       6       6       6
2       6       6       6       6       6       6       6       6       6       3       4       4
3       7       6       6       6       4       6       6       6       6       6       6       6
4       6       6       6       6       6       6       6       6       6       6       6       6
5       4       4       7       6       4       6       6       6       6       6       4       6 …
Run Code Online (Sandbox Code Playgroud)

r dataframe rle

1
推荐指数
2
解决办法
94
查看次数

标签 统计

r ×2

dataframe ×1

rle ×1