50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

packDAMipd (version 1.1.0)

find_rowwise_sum_multiplecol: Function to get sum of multiple columns of observations

Description

Function to get sum of multiple columns of observations

Usage

find_rowwise_sum_multiplecol(the_data, colnames, sumcolname)

Value

the data with added sum

Arguments

the_data

the data where the observations are held

colnames

columnname in the data whose sum to be obtianed

sumcolname

name of the new column where sum to be saved

Examples

Run this code
eg_data <- as.data.frame(list(no = c(1, 2, 3, 4),
mark_at_1 = c(12, 7, 23, 45), gender = c("M", "F", "M", "F"),
mark_at_2 = c(12, 34, 89, 45), trialarm = c("1","1","2","2"),
time = c(1,1,2,2), id = c(1, 1, 1, 2)))
find_rowwise_sum_multiplecol(eg_data, c("mark_at_1","mark_at_2"),
"totalmarks")

Run the code above in your browser using DataLab