From 0742b89c77b5bc63e02adacd5ec68d11cc13d961 Mon Sep 17 00:00:00 2001 From: amarell Date: Sat, 10 Jun 2023 00:27:25 +0200 Subject: [PATCH] Exercise 02 (4th part): create csv data file and analysis --- journal/Readme.md | 6 ++-- module2/exo4/exercice_en.Rmd | 61 ++++++++++++++++++++++++++---------- module2/exo4/mytags.csv | 3 ++ 3 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 module2/exo4/mytags.csv diff --git a/journal/Readme.md b/journal/Readme.md index 641c425..d478d6b 100644 --- a/journal/Readme.md +++ b/journal/Readme.md @@ -5,7 +5,8 @@ This is Anders' logbook for the MOOC on reproducible science Authors: Anders Mårell Created: 2023--06-09 -## First day - 2023-06-08 +## 2023-06-08 +First day Module 1 and parts of module 2. Access to the gitlab was not working so not possible to do some of the exercises. - Learnt about some generalities about making reproducible science and its history. @@ -15,5 +16,6 @@ Module 1 and parts of module 2. Access to the gitlab was not working so not poss - administrators for efno: Anders Mårell and Frédéric Gosselin - added subgroups (efno-st, MOOC-IGN) and members -## Second day - 2023-06-09 +## 2023-06-09 +Second day Continued with module 2 and the exercises in module 1 and module 2. diff --git a/module2/exo4/exercice_en.Rmd b/module2/exo4/exercice_en.Rmd index 13b258d..a03bd4d 100644 --- a/module2/exo4/exercice_en.Rmd +++ b/module2/exo4/exercice_en.Rmd @@ -1,8 +1,10 @@ --- -title: "Your title" -author: "Your name" -date: "Today's date" +title: "Analyzing my logbook data" +author: "Anders Mårell" +date: "2023-06-09" output: html_document +editor_options: + chunk_output_type: console --- @@ -10,24 +12,51 @@ output: html_document knitr::opts_chunk$set(echo = TRUE) ``` -## Some explanations - -This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see . +# Tags used per day +Read in the journal file *Readme.md* that is in the *journal* folder. Then extract the lines with date headings at the second level. We can then extract the tags and the dates: +```{r} +# Import data ------------------------------------------------------------------ +MyData <- readLines(con = here::here("journal", "Readme.md")) + +# Extract lines with headings at the 2nd level --------------------------------- +MyDates <- MyData[grepl(pattern = "##", x = MyData)] + +# Extract the tags ------------------------------------------------------------- +MyTags <- + sub(pattern = "-->", + replacement = "", + x = sub(pattern = ".*