pi (note the lowercase) is defined but e is not, although exp(1) is obviously available.

pi
# [1] 3.141593

The small number of built-in constants are described :

?Constants

It would be possible to cure this lack-of-e problem with this code:

e <- exp(1)
lockBinding("e", globalenv())
e
#[1] 2.718282
e <- 2.5
#Error: cannot change value of locked binding for 'e'

(Thanks to Hadley for illustrating this in a different SO thread.) You probably also should go to:

?NumericConstants

Where you will read among other things: "A numeric constant immediately followed by i is regarded as an imaginary complex number."

The other important constants are TRUE and FALSE, and while T and F can be used in a clean session, T and F are not reserved and can be assigned other values, which will then provoke difficult to debug errors, so their use is deprecated. (Although, I suppose one could also use the lockBinding strategy on them as well.)

There are a few character "constants", such as the 26 item character vectors: letters, LETTERS, as well as 12 months in your locale: month.abb and month.name. The Greek letters (lower and uppercase) and some math notation can be accessed via methods described in ?plotmath.

The state.name and state.abb mentioned by Tyler below are actually part of the (USA) state dataset in the "datasets" package which is loaded by default:

library(help="datasets")

If you see an example that uses the cars, chickwts, iris or any of the other dataframes in "datasets", as many help() examples do, these objects can be assumed to be available on any R user's machine.

Answer from IRTFM on Stack Overflow
Top answer
1 of 1
30

pi (note the lowercase) is defined but e is not, although exp(1) is obviously available.

pi
# [1] 3.141593

The small number of built-in constants are described :

?Constants

It would be possible to cure this lack-of-e problem with this code:

e <- exp(1)
lockBinding("e", globalenv())
e
#[1] 2.718282
e <- 2.5
#Error: cannot change value of locked binding for 'e'

(Thanks to Hadley for illustrating this in a different SO thread.) You probably also should go to:

?NumericConstants

Where you will read among other things: "A numeric constant immediately followed by i is regarded as an imaginary complex number."

The other important constants are TRUE and FALSE, and while T and F can be used in a clean session, T and F are not reserved and can be assigned other values, which will then provoke difficult to debug errors, so their use is deprecated. (Although, I suppose one could also use the lockBinding strategy on them as well.)

There are a few character "constants", such as the 26 item character vectors: letters, LETTERS, as well as 12 months in your locale: month.abb and month.name. The Greek letters (lower and uppercase) and some math notation can be accessed via methods described in ?plotmath.

The state.name and state.abb mentioned by Tyler below are actually part of the (USA) state dataset in the "datasets" package which is loaded by default:

library(help="datasets")

If you see an example that uses the cars, chickwts, iris or any of the other dataframes in "datasets", as many help() examples do, these objects can be assumed to be available on any R user's machine.

🌐
R-Lang
r-lang.com › home › pi in r: built-in constants
Pi in R: Built-in Constants - R-Lang
July 3, 2025 - Pi is a built-in R constant whose value is 3.141593. Pi is the ratio of the circumference of a circle to its diameter.
🌐
ETH Zurich
stat.ethz.ch › R-manual › R-devel › library › base › html › Constants.html
R: Built-in Constants
These are implemented as variables in the base namespace taking appropriate values. ⁠Becker RA, Chambers JM, Wilks AR (1988). The New S Language. Chapman and Hall/CRC, London. ... Quotes for the parsing of character constants, NumericConstants for numeric constants. ## John Machin (ca 1706) computed pi to over 100 decimal places ## using the Taylor series expansion of the second term of pi - 4*(4*atan(1/5) - atan(1/239)) ## months in English month.name ## months in your current locale format(ISOdate(2000, 1:12, 1), "%B") format(ISOdate(2000, 1:12, 1), "%b")
🌐
GeeksforGeeks
geeksforgeeks.org › r language › built-in-constants-in-r
Built-in Constants in R - GeeksforGeeks
July 23, 2025 - R Programming Language includes ... mathematical modeling. The constant pi in R represents the ratio of the circumference of a circle to its diameter, approximately 3.14159....
🌐
RDocumentation
rdocumentation.org › packages › catR › versions › 3.16 › topics › Pi
Pi function - RDocumentation
This command returns the item response probabilities for a given ability value and a given matrix of item parameters under either the 4PL model or any suitable polytomous model. Numerical values of the first, second and third derivatives of the response probabilities are also returned.
🌐
University of Auckland
stat.auckland.ac.nz › ~paul › ItDT › HTML › node63.html
9.3 The R language
R automatically loads some predefined values into memory, with associated symbols. One example is the predefined symbol pi, which is a label for the the mathematical constant .
🌐
RPubs
rpubs.com › andrea_gustafsen › 839901
Estimating Pi Using Monte Carlo Simulation in R
Sign in Register · Estimating Pi Using Monte Carlo Simulation · by Andrea Gustafsen · Last updated over 4 years ago · Hide Comments (–) Share Hide Toolbars ·
Find elsewhere
🌐
NPS
faculty.nps.edu › sebuttre › home › R › intro.html
Introduction to R
> a [1] 3.162278 "a" is just another item to R. There's no distinction between built-in items like "pi" and ones you create.
🌐
Medium
medium.com › data-science › estimating-pi-using-monte-carlo-simulation-in-r-91d1f32406af
Estimating Pi Using Monte Carlo Simulation in R | by Andrea Young-Shin Gustafsen | TDS Archive | Medium
February 26, 2022 - An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication. ... A common example to illustrate how Monte Carlo simulation can be used is by estimating pi. This article will show you how to do this simulation with only a few lines of code using R.
🌐
Datamentor
datamentor.io › r-programming › variable-constant
R Variables and Constants (With Examples)
But it is not good to rely on these, as they are implemented as variables whose values can be changed. pi pi <- 56 pi · Output · [1] 3.141593 [1] 56 · Variables in R · Constants in R · Previous Tutorial: R Reserved Words · Next Tutorial: R Operators · Share on: Did you find this article helpful?
🌐
R Project
search.r-project.org › R › refmans › base › html › Constants.html
R: Built-in Constants
These are implemented as variables in the base namespace taking appropriate values. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. ... Quotes for the parsing of character constants, NumericConstants for numeric constants. ## John Machin (ca 1706) computed pi to over 100 decimal places ## using the Taylor series expansion of the second term of pi - 4*(4*atan(1/5) - atan(1/239)) ## months in English month.name ## months in your current locale format(ISOdate(2000, 1:12, 1), "%B") format(ISOdate(2000, 1:12, 1), "%b")
🌐
Wordpress
simplex758758405.wordpress.com › 2018 › 02 › 23 › approximation-of-pi-π-using-r-a-simple-mathematical-model
Approximation of Pi (π) using R: A simple mathematical model
February 23, 2018 - Assume the radius of the circle to be unit. Therefore, the equation of the circle will become- x2 + y2 = 12 · With our assumption we can see that the value of pi = Area of the circle · Now to approximate the area of the circle with unit area we can consider the quarter part of it and then use the numerical integration techniques to approximate it.
🌐
UCLA
math.ucla.edu › ~anderson › rw1001 › library › base › html › Constants.html
R: Built-in Constants
R has a limited number of built-in constants (there is also a rather larger library of data sets which can be loaded with the function data). ... all(nchar(letters) == 1) # TRUE all(month.abb == substr(month.name, 1, 3)) # TRUE eps <- .Machine$double.eps all.equal(pi, 4*atan(1), tol= 2*eps) # John Machin (1705) computed 100 decimals of pi : all.equal(pi/4, 4*atan(1/5) - atan(1/239), 4*eps)
🌐
R Package
rdrr.io › r › base › Constants.html
Constants: Built-in Constants
These are implemented as variables in the base namespace taking appropriate values. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. ... Quotes for the parsing of character constants, NumericConstants for numeric constants. ## John Machin (ca 1706) computed pi to over 100 decimal places ## using the Taylor series expansion of the second term of pi - 4*(4*atan(1/5) - atan(1/239)) ## months in English month.name ## months in your current locale format(ISOdate(2000, 1:12, 1), "%B") format(ISOdate(2000, 1:12, 1), "%b")
🌐
R Project
search.r-project.org › CRAN › refmans › FunWithNumbers › html › bpp.html
R: Function which calculates pi, or other irrationals, using the...
The BPP algorithm calculates the sum(K=0,k, 1/(b^K) * FracSum) , where FracSum is defined by the sum(M=1,m, A[M]/(m*K + M)^s) . This means that the number of elements of A must equal m. Zero values are legal and are used to reject fractions not wanted in the inner sum. The default values for pdat correspond to the coefficients used to generate pi (the sum to infinity is mathematically equal to pi).
🌐
RDocumentation
rdocumentation.org › packages › BootPR › versions › 1.0 › topics › Plot.PI
Plot.PI Plotting prediction intervals and point forecasts
The function returns plots the point forecasts and prediction intervals · Plot.PI(x, fore, Interval, start, end, frequency) plot · x · a time series data set · fore · point forecasts · Interval · Prediction Intervals · start · starting date · end · ending date ·
🌐
PC Ministry
thestarman.pcministry.com › math › pi › pifacts.html
Pi: Facts and Figures
Area of a Circle. The Symbol (π) itself The Greek Letter. When was π first used this way? ... For various proofs that the area A = π r2, see: Area of a Disk, Archimedes on C & A and this Video. is the 16th letter of the Greek alphabet (it also denoted the number 80 in ...
🌐
Third Space Learning
thirdspacelearning.com › home › us elementary guides › 𝝅r² (pi r squared)
Pi r squared - Math Steps, Examples & Questions
September 10, 2024 - Example 1: calculating the area ... semicircle given the diameter ... Here you will learn about using the formula \boldsymbol{\pi} r^2 \text { (pi r squared) } to calculate the area of a circle given the radius, diameter, or ...
🌐
Quora
quora.com › What-is-pi-r-squared-equal-to
What is pi r-squared equal to? - Quora
Answer (1 of 6): r x r is a square. pi is a scalar factor which scales up this square into a bigger square. Imagine now with every digit of pi this square keeps getting bigger and bigger with every digit. As such the scalar factor is never constant so neither is the area of this square. If you ...