R로 시계열 데이터 다루기
Harrison Brown
Graduate Researcher in Geography
이동 윈도우:
확장 윈도우:
윈도우 폭 증가:
사용 가능한 데이터의 요약은?
고정 시작점:

R에서의 확장 윈도우:
zoo::rollapply()width는 단일 수 또는 벡터 가능확장 윈도우 폭:
1, 2, 3, 4, ...수열 생성 함수:
base::seq_along()seq_along(daily_temp)
[1] 1 2 3 4 5 6 7 8 9 ...
... 363 364 365
exp_widths <- seq_along(daily_temp)
exp_widths
[1] 1 2 3 4 5 ... 363 364 365
temp_expand <-
rollapply(
data = daily_temp,
FUN = mean,
width = exp_widths,
# Alignment must be 'right'
align = 'right'
)
ggplot() + # Original data geom_line(data = daily_temp, aes(x = Index, y = daily_temp), color = 'grey50') +# Expanding window plot geom_line(data = temp_expand, aes(x = Index, y = temp_expand), color = 'red') + theme_light() + labs(y = 'Degrees Celsius')


R로 시계열 데이터 다루기