Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

r
communitycreator

What is the options() function in R?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The options() function in R is used to set and examine different global options that affects the way in which R determines and returns its results.

Syntax

The options() function takes the syntax below:

options(…)
Syntax for the options() function in R

Parameter value

The options() function takes the parameter value, ..., which represents any option that can be defined using name=value.

Below, we have a list of some options that are used in base R:

Options

result

add.smooth

TRUE

check.bounds

FALSE

continue

“+”

digits

7

echo

TRUE

encoding

“native.enc”

expressions

5000

Code

# implementing the options() function
# setting the digits option
options(digits=10)
print(10/7)
# to set the console width
options(width=100)
Implementing the options() function

Explanation

  • Line 3: We set the digits option to 10 using the options() function.
  • Line 4: We obtained the result of an arithmetic operation.
  • Line 7: We set the console width to 100.

RELATED TAGS

r
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring