Time Series Plotter
Build an R tool that plots measurements recorded over time, such as daily temperatures, website visits or sensor readings, and clearly shows where data is missing: gaps in the dates are detected and shaded on the chart, so nobody mistakes a straight line across a gap for real data. It reads a CSV, checks the dates and values, finds the expected frequency (daily, hourly and so on), lists the missing periods, and draws a clean ggplot2 chart with an optional moving average, which you can also explore in a small Shiny app. It's a good first R project: you'll learn reading data with readr, working with dates using lubridate, finding gaps with dplyr and tidyr, ggplot2 charts, and a first Shiny app.
- Estimate
- ~7.5h
- Steps
- 6
- Completed by
- 0
- Proposed by
- codeseed.app
tidyverse · lubridate · ggplot2 · Shiny
Project roadmap
- 01
Define the input and output
~1hWrite README.md: the input is a CSV with a date or date-time column and one or more numeric columns; the outputs are a chart (PNG) with missing periods shaded, and a table of the missing periods (start, end and how many points are missing). Prepare a sample file with a few gaps and some invalid rows. Install the tidyverse, lubridate and shiny. Done when: README.md describes the input and outputs, and the sample file is ready.
- 02
Load and check the data
~1hLoad the file with readr, parse the date column with lubridate (trying a few formats), and check it: remove rows whose date can't be parsed or whose value isn't a number (reporting how many), sort by date, and warn about duplicate dates (keeping the first). Done when: the sample file loads, and the invalid rows are reported.
- 03
Find the missing periods
~1.5hWork out the expected frequency from the most common gap between consecutive dates, build the complete sequence of expected dates with seq() (or tidyr::complete), and find the missing ones, grouping consecutive missing dates into periods. Done when: the missing periods table matches the gaps you put in the sample file.
- 04
Plot the series
~1.5hDraw the series with ggplot2, with gaps left as breaks in the line (not joined across), missing periods shaded with geom_rect, an optional 7-point moving average line (computed with slider or zoo), a clear title and axis labels, and date labels that suit the time range. Save it as a PNG. Done when: the chart shows the data with gaps clearly shaded.
- 05
Add a small Shiny app
~1.5hBuild a Shiny app where the user uploads a CSV, chooses the date and value columns, toggles the moving average and picks a date range, and sees the chart and the missing periods table update. Show clear messages for files without a usable date column. Done when: uploading the sample file shows the chart and table, and changing options updates them.
- 06
Test it
~1hWrite testthat tests for the gap detection (no gaps, one gap, several gaps, a gap at the start or end, and hourly data), frequency detection and the date parsing of mixed formats. Done when: all tests pass.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack