R-使用Weathermetrics软件包计算热量指数 - 错误结果



我正在尝试从数据框架"天气"中的温度和相对湿度计算热量指数。为了计算它,使用了软件术。

我的代码如下:

weather$heat_index <- heat.index(t = weather$temperature_outdoor_celsius, 
rh = weather$humidity_perc, temperature.metric = 'celcius', output.metric = 'celcius', round = 10)

但是,包装返回与温度相同的值,何时应返回不同的值。

如果我将其应用于特定示例

> heat.index(t = 12, rh = 70, temperature.metric = 'celcius', 
output.metric = 'celcius', round = 10)
    [1] 12

结果为12 celcius。但是,结果应为11 celcius,根据该软件包列出的网页,该网页列出了该软件包使用的算法的来源(http://www.wpc.ncep.noaa.gov/html/heatindex.shtml)。似乎该函数只是返回温度的值,而不是以任何方式处理。

我的代码或功能中的问题是?

看起来您已经误入字母了。如果您将'celsius'而不是'celcius'用于公制选项,则可以正常工作。在下面的示例中使用此内容,返回11的结果。

heat.index(t = 12, rh = 70, temperature.metric = 'celsius', 
output.metric = 'celsius', round = 10)
>[1] 11.1

最新更新