使用weathermetrics软件包计算热指数 - 错误的结果
问题描述:
我想从数据框'天气'中的温度和相对湿度计算热指数。为了计算它,使用包裹weathermetrics。使用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摄氏度。然而,根据该软件包列为该软件包使用算法源的网页(http://www.wpc.ncep.noaa.gov/html/heatindex.shtml),结果应该是11 Celcius。看来该函数只是返回温度的值而不是以任何方式处理它。
问题在我的代码或功能?
答
看起来你错了一封信。如果您使用'celsius'
而不是'celcius'
作为度量选项,则它将正确运行。在你的例子中使用这个,返回11的结果。
heat.index(t = 12, rh = 70, temperature.metric = 'celsius',
output.metric = 'celsius', round = 10)
>[1] 11.1
这真是一个愚蠢的错误。谢谢! –