In R, you can use operators to perform common mathematical operations on numbers.
The +
operator is used to add together two values:
And the -
operator is used for subtraction:
You will learn more about available operators in our R Operators Tutorial.
R also has many built-in math functions that allows you to perform mathematical tasks on numbers.
For example, the min()
and max()
functions can be used to find the lowest or highest number in a set:
The sqrt()
function returns the square root of a number:
The abs()
function returns the absolute (positive) value of a number:
The ceiling()
function rounds a number upwards to its nearest integer, and the floor()
function rounds a number downwards to its nearest integer, and returns the result:
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!