In R, log is the natural logarithm. In calculators, log usually means base 10 logarithm. To achieve that in R you can use the log10 function.

log(5)
## [1] 1.609438
log10(5)
## [1] 0.69897

As for your formula, it seems correct, since log is the natural logarithm.

Answer from alko989 on Stack Overflow
🌐
Statology
statology.org › home › how to calculate log in r (with examples)
How to Calculate Log in R (With Examples)
June 18, 2021 - #define vector x <- c(3, 6, 12, 16, 28, 45) #calculate log of each value in vector with base e log(x) [1] 1.098612 1.791759 2.484907 2.772589 3.332205 3.806662 · The following code shows how to calculate the log of values in a specific column of a data frame in R:
🌐
RDocumentation
rdocumentation.org › packages › base › versions › 3.6.2 › topics › log
log: Logarithms and Exponentials
a positive or complex number: the base with respect to which logarithms are computed. Defaults to \(e\)=exp(1). A vector of the same length as x containing the transformed values. log(0) gives -Inf, and log(x) for negative values of x is NaN.
🌐
Educative
educative.io › answers › how-to-calculate-the-log-of-a-value-in-r
How to calculate the log() of a value in R
The log() function in R calculates the logarithm of a number to the base. log() calculates the natural logarithm of a number if the base is not specified by the user. The following illustration shows the mathematical representation of the log() ...
🌐
Medium
medium.com › @michael71314 › r-lesson-30-logarithms-5b72b818d3d3
R Lesson 30: Logarithms | by Michael Orozco-Fletcher | Medium
July 7, 2023 - In this example, I’m showing a base-2 logarithm, which is a logarithm with a base of, well, 2. In this case, the base-2 log of 8 is 3, since 2³=8. NOTE: Just like the case with the base-10 logarithm, you can also use the code log(8, base=2) to calculate this base-2 algorithm. Now let’s explore two rather unusual logarithmic scenarios-logarithms of imaginary numbers and logarithms with base e (e as in the mathematical constant).
🌐
SQLPad
sqlpad.io › tutorial › calculate-logarithm
How to Calculate Logarithm in R | SQLPad
May 7, 2024 - Step-by-step guide on calculating logarithms in R. Detailed exploration of R's log() function and its parameters.
🌐
DataScience Made Simple
datasciencemadesimple.com › home › log function in r – log(),log2(),log10()
Log function in R - log(),log2(),log10() - DataScience Made Simple
July 3, 2020 - #### Log to the base 2 , base10 and natural logarithmic value of the column in R my_basket$log_base2 = log2(my_basket$Price) my_basket$log_base10 = log10(my_basket$Price) my_basket$log_base_e = log(my_basket$Price) my_basket$log_base3 = log(my_basket$Price, base=3) so the resultant dataframe with log(), log2(), log10() and log3() calculated on the “price” column will be ·
🌐
RCODER
r-coder.com › home › r introduction › logarithm and exponential in r
Logarithm and exponential in R [exp(), log(), log10(), log2() ...
December 30, 2023 - Learn how to calculate the exponential and logarithm in R with the exp(), expm1(), log(), log10(), log2() and log1p() functions
Find elsewhere
🌐
Psu
astrostatistics.psu.edu › su07 › R › html › base › html › Log.html
R: Logarithms and Exponentials
log10 and log2 are only special cases, but will be computed more efficiently and accurately where supported by the OS. A vector of the same length as x containing the transformed values. log(0) gives -Inf (when available). ... R, but logb is preferred if base is specified, for S-PLUS compatibility.
🌐
UCLA
math.ucla.edu › ~anderson › rw1001 › library › base › html › Log.html
R: Logarithms and Exponentials
log computes natural logarithms, log10 computes common (i.e., base 10) logarithms, and log2 computes binary (i.e., base 2) logarithms. The general form log(x, base) computes logarithms with base base (log10 and log2 are only special cases). log1p(x) computes log(1+x) accurately also for |x| ...
🌐
R-Lang
r-lang.com › home › calculating natural log using log() function in r
Calculating Natural Log using log() Function in R - R-Lang
December 3, 2024 - In R, the formula for the natural log is ln(x) = loge(x), where e is the base. One common confusion is that if you follow the “Calculators (mechanical device),” natural log means log10.
🌐
GeeksforGeeks
geeksforgeeks.org › performing-logarithmic-computations-in-r-programming-log-log10-log1p-and-log2-functions
Performing Logarithmic Computations in R Programming - log(), log10(), log1p(), and log2() Functions - GeeksforGeeks
June 5, 2020 - The log2() is an inbuilt function in R which is used to calculate the logarithm of x to base 2, where x is the specified value or throws infinity for 0 and NaN for negative value.
🌐
GeeksforGeeks
geeksforgeeks.org › logarithmic-and-power-functions-in-r-programming
Logarithmic and Power Functions in R Programming - GeeksforGeeks
June 1, 2020 - First is the Logarithm, to which the general way to calculate the logarithm of the value in the base is with the log() function which takes two arguments as value and base, by default it computes the natural logarithm and there are shortcuts ...
🌐
Ku
biostat.ku.dk › r › BasicR.html
2 Basic R | Introduction to R
Space is not allowed in the name and each name is case-sensitive, such that Age and age are two different variable names. Storing values can be really handy when you need to do further calculations on a value. Now watch the video (3 min) below illustrating some of the topics covered so far (click the HD-button at the lower right corner of the video to view in highest possible solution): ... # R as calculater 1+5 3*(1+5)/(4+2^2) 3*1+5/4+2^2 # order of operations # some more log(5) exp(5) sqrt(5) # store simple values y <- sqrt(5) y 5/y y*2 Y # case sensitivity
🌐
Walshc
walshc.github.io › pqs › r-as-a-calculator.html
Programming and Quantitative Skills for IBA - R - 3 R as a Calculator
In R we can use the exp() function to calculate the exponential of any number: ... Another common mathematical function is the logarithm, which is like the reverse of exponentiation.
🌐
Edubrain
edubrain.ai › home › logarithm calculator
Free Logarithm Calculator - Edubrain.ai
February 21, 2026 - It measures the common logs, natural logs as well as custom bases, and indicates the steps of calculation explicitly. ... Calculating the logarithms of any base without the need to make use of tables or approximation. The calculator shows the use of the rules of logarithms to all the expressions.
🌐
Educative
educative.io › answers › what-is-the-log-function-in-r
What is the log() function in R?
The log() function in R is used to obtain the logarithm (the natural logarithm, by default) of a given input numeric or complex vector.
🌐
Calculator.net
calculator.net › home › math › log calculator
Log Calculator (Logarithm)
This free log calculator solves for the unknown portions of a logarithmic expression using base e, 2, 10, or any other desired base.