How do you set the decimal places in the R language?

In R, you can use the function options(digits = n) to set the number of decimal places to display, where n represents the number of decimal places to show.

For example, to set the decimal point to 2 digits, you can use the following code:

options(digits = 2)

In the following calculations and outputs, all numbers will be rounded to two decimal places.

bannerAds