Sum of Two or Multiple Data Frame Columns in R (2 Examples) | Addition of Variables | rowSums Subset

Описание к видео Sum of Two or Multiple Data Frame Columns in R (2 Examples) | Addition of Variables | rowSums Subset

How to calculate the sum of two or more data frame columns in the R programming language. More details: https://statisticsglobe.com/sum-of-tw...
R code of this video:

data <- data.frame(x1 = 1:5, # Create data frame
x2 = c(3, 1, 7, 4, 4),
x3 = 5:9,
x4 = c(7, 4, 6, 4, 9))

data$x1 + data$x2 # Sum of two columns

rowSums(data[ , c("x1", "x2", "x4")]) # Sum of multiple columns

Follow me on Social Media:
Facebook:   / statisticsglobecom  
LinkedIn:   / statisticsglobe  
Twitter:   / joachimschork  

Комментарии

Информация по комментариям в разработке