calculating column values based on other values

Hi everyone

I have this dataset

sector	    x 	         y
AA	 2,339,420,681,734 	99.8%
BB	 371,624,845,717 	99.0%
CC	 87,634,499,611 	99.6%
DD	 1,574,141,187,993 	100.0%
EE	 11,872,797,513,892 	99.2%
FF	 29,278,939,620 	99.3%
GG	 1,239,742,259,291 	99.7%
HH	 378,196,970,011 	99.2%
JJ	 1,112,863,452,542 	99.9%
KK	 11,094,449,154,530 	99.4%
LL	 132,484,420,106 	100.0%
MM	 414,378,771,482 	99.6%
NN	 407,184,157,752 	99.4%
OO	 504,904,229,961 	98.8%
PP	 5,073,887,827,567 	99.6%
QQ	 114,423,889,566 	100.0%
RR	 330,622,219,467 	100.0%
SS	 2,117,184,188,890 	99.0%
TT	 3,071,872,320,787 	99.8%
UU	 3,640,173,923,590 	99.7%
VV	 69,376,312,211 	100.0%
WW	 2,322,262,020,988 	99.8%
XX	 247,168,286,858 	99.9%
ZZ	 1,662,614,039,790 	100.0%
AAA	 349,885,446,127 	99.9%
BBB	 729,517,068,837 	98.9%
CCC	 93,011,710,959 	99.9%

I need to have a new column (let say z) which are calculated from the multiplication of x and y (z ~ x . y). The condition is Σz > Σ(x . y), or Σz =52,143,500,004,971.10.

What should I do?

Sticking to tidyverse check out rowwise with dplyr. You could probably also do something like dplyr::mutate(z = purrr::map2_*(x, y, \(x, y) ...)) -- where * would be the desired output type (int, double, etc.) -- if you don't want to go the rowwise route for some reason.

Thanks alot man.. I'll try to find out more about rowwise and purr functions..

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.