Only show the last two days

This commit is contained in:
2021-10-25 21:41:41 +02:00
parent 9fb63a3cb3
commit f88592a60c
+8 -1
View File
@@ -6,13 +6,20 @@ output: html_document
```{r setup, include=FALSE} ```{r setup, include=FALSE}
library(ggplot2) library(ggplot2)
knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(echo = TRUE)
df <- read.csv("../data.csv", header = F) df <- read.csv("../data.csv", header = F)
colnames(df) <- c("date", "name", "topic", "humidity", "temperature", "presure", "battery", "voltage", "linkquality") colnames(df) <- c("date", "name", "topic", "humidity", "temperature", "presure", "battery", "voltage", "linkquality")
df$date <- as.POSIXct(df$date) df$date <- as.POSIXct(df$date)
now <- Sys.time()
cut_off <- now - (2*60*60*24)
df <- subset(df, date > cut_off)
``` ```
```{r echo=FALSE} ```{r echo=FALSE}
Sys.time() now
cut_off
``` ```
## Humidity ## Humidity