[R] Conversion from python to R - log-problem
Martin Møller Skarbiniks Pedersen
tr@xp|@yer @end|ng |rom gm@||@com
Mon Oct 28 00:01:40 CET 2019
Hi,
I am trying to convert a small python computation to R but my R version
gets the wrong result.
The python code:
import math import log
x = log(2)
for i in range(3,7):
x = log(i)**x
print(x)
3.14157738716919
My R-version:
x <- log10(2)
for (i in 3:6) {
x <- log10(i)**x
}
print(x)
[1] 0.8207096
=
range(3,7) (Python) is the same as 3:6 (R)
log() (Python) is the same as log10 (R)
What can be wrong?
Regards
Martin M. S. Pedersen
ps. I hope this is plain text without any HTML.
[[alternative HTML version deleted]]
More information about the R-help
mailing list