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.
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.
ETH Zurich
stat.ethz.ch › R-manual › R-devel › library › base › help › log.html
R: Logarithms and Exponentials
Index of /R-manual/R-devel/library/base
Top answer 1 of 3
44
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.
2 of 3
4
In addition I will point out that your model
y ~ a + b*(x/305) + c*((x/305)^2) + d*log(305/x) + f*(log(305/x))^2
is linear in the statistical sense of being linear in the coefficients; it doesn't need to be linear in x.
You don't need nls to fit this model, you could use lm().
But remember to look at the I() function to express terms like (x/305)^2.
ETA example:
aDF <- data.frame(x=abs(rnorm(100)), y=rnorm(100))
lm(y ~ 1 + I(x/305) + I((x/305)^2) + log(305/x) + I(log(305/x)^2), data=aDF)
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).
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 ·
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| ...
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.