롤링 함수

사례 연구: R로 도시 시계열 데이터 분석

Lore Dirick

Manager of Data Science Curriculum at Flatiron School

이산 윈도우

  • 기간별로 데이터 분할

    unemployment_yrs <- split(unemployment, f = "years")
    
  • 기간 내 함수 적용

    unemployment_yrs <- lapply(unemployment_yrs, cummax)
    
  • 새 데이터를 xts 객체로 결합

    unemployment_ytd <- do.call(rbind, unemployment_yrs)
    
사례 연구: R로 도시 시계열 데이터 분석

롤링 윈도우

  • rollapply()는 롤링 윈도우에 함수를 적용합니다
    unemployment_avg <- rollapply(unemployment,
                                  width = 12,
                                  FUN = mean)
    

12개월 윈도우 평균을 구하기 위해 rollapply()를 사용한 플롯

사례 연구: R로 도시 시계열 데이터 분석

연습해 봅시다!

사례 연구: R로 도시 시계열 데이터 분석

Preparing Video For Download...