abs()
abs()
The
abs()
function will produce the absolute value for a number.
Example:
The code below will take the residuals from the empty model for Thumb in the Fingers data frame, and give back their absolute value.
empty_model
<- lm(
Thumb ~ NULL
, data =
Fingers
)
Fingers$Residual
<- resid(
empty_model
)
abs(
Fingers$Residual
)
Example output: