R将数据帧的几列与另一列相乘
我有以下结构的数据框:R将数据帧的几列与另一列相乘,r,dataframe,multiplication,R,Dataframe,Multiplication,我有以下结构的数据框: id country year money1 money2 convert 1 country1 1991 4641 8494 3.1 2 country1 1991 2547 9568 3.1 3 country1 1992 3671 1494 3.3 4 country1 1992 8634 3524 3.3 5 country2 1993 8569 8496 1.7 6 country2 1993 9564
id country year money1 money2 convert
1 country1 1991 4641 8494 3.1
2 country1 1991 2547 9568 3.1
3 country1 1992 3671 1494 3.3
4 country1 1992 8634 3524 3.3
5 country2 1993 8569 8496 1.7
6 country2 1993 9564 2469 1.7
7 country2 1994 3569 5496 1.9
8 country2 1994 5564 6469 1.9
convert的值随国家和时间而变化,但不随id而变化。我想在一个步骤中将money1和money2列与convert的相应值相乘,并使其他列保持不变。到目前为止,我没有运气
有人能帮我吗
谢谢 感谢所有回答的人 关键是,这是一个愚蠢的问题,因为我只是在代码中丢失了概述。这给我留下的印象是,我过去进行转换的方式,与阿南达提出的方式类似,在实际工作时并不起作用 无论如何谢谢你,很抱歉浪费了你的时间
是否可以删除此问题和答案,因为它对任何人都没有帮助?您可以分享您迄今为止的尝试吗?您是否只想将两列乘以转换列?您可以删除此问题并找回您的代表。