Absolute Value in R (2 Examples) | abs Function | Convert Vector & Data Matrix to Positive Values

preview_player
Показать описание
R code:

##### Example 1
x <- c(- 5, 9, 3, - 1, 2) # Create example vector

x_abs <- abs(x) # Apply abs function in R
x_abs # Print output to RStudio console

##### Example 2
mat <- matrix(- 9:5, nrow = 3, ncol = 5) # Create example matrix
mat # Print output to RStudio console

mat_abs <- abs(mat) # Apply abs function to matrix
mat_abs # Print output to RStudio console
Рекомендации по теме
Комментарии
Автор

Thanks for the video Joachim, Merry Christmas.

agsoutas