Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

SUpporting GRaphics with R for ANalysing Time Series

NotificationsYou must be signed in to change notification settings

earowang/sugrrants

Repository files navigation

R build statusCRAN_Status_BadgeDownloads

The goal ofsugrrants is to provide supporting graphs with R foranalysing time series data. It aims to fit into thetidyverse andgrammar of graphics framework for handling temporal data.

Installation

You could install the stable version on CRAN:

install.packages("sugrrants")

You could also install the development version from Github using:

# install.packages("remotes")remotes::install_github("earowang/sugrrants")

Usage

Calendar-based graphics

The fully-fledged faceting calendarfacet_calendar() unlocksday-to-day stories.

library(dplyr)library(sugrrants)hourly_peds %>%  filter(Date< as.Date("2016-05-01")) %>%   ggplot(aes(x=Time,y=Hourly_Counts,colour=Sensor_Name))+  geom_line()+  facet_calendar(~Date)+# a variable contains dates  theme_bw()+  theme(legend.position="bottom")

On the other hand, theframe_calendar() provides tools forre-structuring the data into a compact calendar layout, without usingthe faceting method. It is fast and light-weight, although it does notpreserve the values.

p<-hourly_peds %>%  filter(Sensor_ID==9,Year==2016) %>%  mutate(Weekend= if_else(Day%in% c("Saturday","Sunday"),"Weekend","Weekday")) %>%  frame_calendar(x=Time,y=Hourly_Counts,date=Date) %>%   ggplot(aes(x=.Time,y=.Hourly_Counts,group=Date,colour=Weekend))+  geom_line()+  theme(legend.position="bottom")prettify(p)

Google Summer of Code 2017

This package is part of the project—Tidy data structures and visualmethods to support exploration of big temporal-contextdata,which has been participated in Google Summer of Code 2017 (gsoc), forRproject for statistical computing.

A new functionframe_calendar()[hereandhere]in thesugrrants package has been developed and documented forcalendar-based graphics. I have also written a vignette[sourceandreaderview],which introduces and demonstrates the usage of theframe_calendar()function.Many unittestshave been carried out to ensure the expected performance of thisfunction. The function implements non-standard evaluation and highlightsthetidy evaluation in action. The initialrelease (v0.1.0) of the package has been published onCRAN during the gsocsummer time.

I have initialised a new R packagetsibble for tidy temporaldata, as part of the project. Thetsibble() function constructs a newtbl_ts class for temporal data, and theas_tsibble() helps toconvert a fewts objects into thetbl_ts class. Some key verbs(generics) from thedplyr package, such asmutate(),summarise(),filter(), have been defined and developed for thetbl_ts data class. Thetsibble package was highly experimentalover the period of the gsoc[commits],and these functions are very likely to be changed or improved in thefuture.

A new packagerwalkr has beencreated and released onCRAN during the gsocsummer. This package provides API to Melbourne pedestrian sensor dataand arrange the data in tidy temporal data form. Two functions includingwalk_melb()andshine_melb(),have been written and documented as the v0.1.0 and v0.2.0 releases onCRAN. The majority of the code for the functionrun_melb()has been done, but the interface needs improving after the gsoc.

Miscellaneous

The acronym ofsugrrants isSUpportingGRaphs withR forANalysingTimeSeries, pronounced as “sugar ants” that are aspecies of ant endemic to Australia.


Please note that this project is released with aContributor Code ofConduct.By participating in this project you agree to abide by its terms.


[8]ページ先頭

©2009-2025 Movatter.jp