简体   繁体   English

如何计算R中的对数底数为十

[英]How to calculate negative log base ten in R

I have a dataframe called mydf . 我有一个名为mydf的数据mydf I want to calculate -log base 10 for all the values in mydf$colx . 我想为mydf$colx所有值计算-log base 10

You can use either the log10(x) function or the general form log(x, base) : 您可以使用log10(x)函数或一般形式的log(x, base)

-log10(100)
# [1] -2

log10(100) * -1
# [1] -2

-log(100, base = 10)
# [1] -2

log(100, base = 10) * -1
# [1] -2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM