在这个 df 中,我有 latitute、longtitude 和 datetime,我想计算该特定时间的特定位置的时区。
> dput(df)
structure(list(lat = structure(c(1L, 7L, 4L, 2L, 3L, 10L, 9L,
6L, 5L, 8L), .Label = c("18<f8> 26' 01.91\" N", "18<f8> 29' 09.80\" N",
"19<f8> 24' 36.35\" N", "19<f8> 40' 19.15\" N", "27<f8> 57' 02.07\" N",
"32<f8> 22' 45.20\" N", "32<f8> 42' 56.65\" N", "33<f8> 29' 39.01\" N",
"38<f8> 58' 56.02\" N", "41<f8> 39' 10.09\" N"), class = "factor"),
long = structure(c(1L, 10L, 3L, 2L, 4L, 6L, 8L, 7L, 5L, 9L
), .Label = c("068<f8> 57' 57.17\" W", "069<f8> 55' 52.36\" W",
"071<f8> 23' 28.83\" W", "071<f8> 26' 35.85\" W", "082<f8> 27' 25.83\" W",
"083<f8> 32' 16.32\" W", "086<f8> 18' 27.85\" W", "094<f8> 40' 14.85\" W",
"111<f8> 55' 33.78\" W", "117<f8> 09' 39.90\" W"), class = "factor"),
datetimeval = structure(c(503649060, 811578660, 812097060,
861690660, 762935460, 588666660, 681201060, 524817060, 673425060,
776500260), class = c("POSIXct", "POSIXt"), tzone = "")), .Names = c("lat",
"long", "datetimeval"), row.names = c(NA, -10L), class = "data.frame")
>
我正在使用 googleway 包中的 google_timezone 函数。但我不知道如何将 lat long 转换为十进制格式。
df$timezone <- googleway::google_timezone( c(-37.81659, 144.9841),timestamp = df$datetimeval, key = key)