# NOT RUN {
iris = compute(iris, {
new_median = median_row(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
new_mean = mean_row(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
})
dfs = data.frame(
test = 1:5,
aa = rep(10, 5),
b_ = rep(20, 5),
b_1 = rep(11, 5),
b_2 = rep(12, 5),
b_4 = rep(14, 5),
b_5 = rep(15, 5)
)
# calculate sum of b* variables
compute(dfs, {
b_total = sum_row(b_, b_1 %to% b_5)
})
# conditional modification
do_if(dfs, test %in% 2:4, {
b_total = sum_row(b_, b_1 %to% b_5)
})
# }
Run the code above in your browser using DataLab