diff --git a/.gitignore b/.gitignore index 84100ed..edf9efd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ data.csv .ruby-version config.yaml +.Rproj.user +data_analysis/report.html diff --git a/data_analysis/data_analysis.Rproj b/data_analysis/data_analysis.Rproj new file mode 100644 index 0000000..8e3c2eb --- /dev/null +++ b/data_analysis/data_analysis.Rproj @@ -0,0 +1,13 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX diff --git a/data_analysis/report.Rmd b/data_analysis/report.Rmd new file mode 100644 index 0000000..a94097d --- /dev/null +++ b/data_analysis/report.Rmd @@ -0,0 +1,25 @@ +--- +title: "Report" +output: html_document +--- + +```{r setup, include=FALSE} +library(ggplot2) +knitr::opts_chunk$set(echo = TRUE) +df <- read.csv("../data.csv", header = F) +colnames(df) <- c("date", "name", "topic", "humidity", "temperature", "presure", "battery", "voltage", "linkquality") +df$date <- as.POSIXct(df$date) +``` + +## Humidity +```{r} +p_humidity <- ggplot(df, aes(x=date, y=humidity, group=name, color=name)) + geom_line() +p_humidity +``` + +## Temperature +```{r} +p_temperature <- ggplot(df, aes(x=date, y=temperature, group=name, color=name)) + geom_line() +p_temperature +``` + diff --git a/data_analysis/report.sh b/data_analysis/report.sh new file mode 100755 index 0000000..9c8a419 --- /dev/null +++ b/data_analysis/report.sh @@ -0,0 +1,3 @@ +# Compiles the markdown report into an html file +# run for the first time install.packages("rmarkdown") +Rscript -e 'library(rmarkdown); rmarkdown::render("report.Rmd", "html_document")' \ No newline at end of file