Calculate the absolute value in R programming – abs() method Improve Improve Improve Like Article Like Save Article Save Share Report issue Report abs() method in R programming is used to get the absolute value that is positive value doesn’t change and negative value converted into positive value. Syntax: abs(value) Return: Returns the absolute value. Example 1: # R program to calculate absolute value # Using abs() method answer1 <- abs(-12) answer2 <- abs(21) answer3 <- abs(-2) print(answer1) print(answer2) print(answer3) Output: [1] 12 [2] 21 [3] 2 Example 2: # R program to calculate absolute value # Using abs() method answer1 <- abs(c(1, 2, 3, 4)) answer2 <- abs(c(1, -2, 3, -4)) print(answer1) print(answer2) Output: [1] 1 2 3 4 [2] 1 2 3 4 Last Updated : 10 May, 2020 Like Article Save Article Previous Performing Binomial Test in R programming - binom.test() Method Next Splitting Strings in R programming - strsplit() method Share your thoughts in the comments Add Your Comment Please Login to comment...