Created: r Sys.time()

library(knitr)
knitr::opts_chunk$set(list(echo=TRUE,
                           eval=FALSE,
                           cache=FALSE,
                           warning=FALSE,
                           message=FALSE))
opts_chunk$set(fig.width = 10, fig.height = 10)
library(stringr)
library(tidyverse)
options("download.file.method"="curl")

Manipulating the existing exercises

Corrections, translations and additions are more than welcome for existing exercises that reside as yaml-files in ./data-folder. Yaml-format was chosen as it is easy to manually type even through Github website.

Each exercise block must contain, at minimum, the following fields

``{bash, eval=FALSE} - id: extra_create_character_vector domain: extra lang_en: "Create a character vector containing wordsoneandtwo`" ans: c("one", "two")

where, 

| col | description | optional |
| --- | ----------------------------------  | ------------------  |
| `id` | must be a unique identifier for that exercise | required |
| `domain` | must refer to the domain exercise is part of. For clarity each domain has been splitted into its own file! | required |
| `grade` | a qualitative description of how challenging the exercise is like `easy`, `moderate` or `difficult`  | optional |
| `lang_en` | the question in at least one language | at least one language required | 
| `extra` | Some extra notation for the particular exercise, for instance a preformatted table of how the output should look like. | optional |
| `ans` | the correct answer | required |

For multiple languages and altertive correct answers you can do for instance:

```{bash, eval=FALSE}
- id: extra_data_structure_dataframe
  domain: extra
  grade: easy
  lang_fi: "Luo data ydinasevaltioista, niiden presidenteistä/valtiopäämiehistä ja väestömäärästä (ks. https://en.wikipedia.org/wiki/List_of_states_with_nuclear_weapons)"
  lang_en: "Create data of states with nuclear weapons, with presidents/heads of state and population (see https://en.wikipedia.org/wiki/List_of_states_with_nuclear_weapons)"
  lang_se: "Skapa tabell över stater med kärnvapen, med presidenter och befolkning"
  lang_ru: "Создать таблицу государств с ядерным оружием, с президентами и населением"
  extra: |
        ## Data should look like this!
        ##             country         president population
        ## 1      United States      Donald Trump       1234
        ## 2 Russian Federation    Vladimir Putin       1234
        ## 3             France François Hollande       1234
        ## 4     United Kingdom      Elisabeth II       1234
        ## 5              China        Xi Jinping       1234
  ans: |
        data.frame(country = c('United States','Russian Federation','France','United Kingdom','China'),
                    president = c('Donald Trump','Vladimir Putin','François Hollande','Elisabeth II','Xi Jinping'),
                    population = c(1234,1234,1234,1234,1234),
                    stringsAsFactors=FALSE)
                    )
        # Or
        dplyr::data_frame(country = c('United States','Russian Federation','France','United Kingdom','China'),
                    president = c('Donald Trump','Vladimir Putin','François Hollande','Elisabeth II','Xi Jinping'),
                    population = c(1234,1234,1234,1234,1234))
                    )
        tibble::tribble(
        # Or
        ~country, ~president, ~population,
        "United States","Donald Trump",1234,
        "Russian Federation","Vladimir Putin",1234,
        "United Kingdom","François Hollande",1234,
        "France","Elisabeth II", 1234,
        "China" ,"Xi Jinping", 1234
        )

Adding new exercises into existing domains

You can add you exercises into existing domains just by following the guidelines above. Leave the final line empty in the yaml-file! Please make a pull request into Github if you think they would benefit someone else too!

You must re-build the package to make the additions available.

Adding new domains with new exercises

To make the most out of your R-courses it is good idea to create your own set of questions spesific to your domain or organisation. If you think they are useful for other, please make a pull request and we will incorporate them with the package. If they are tailored for your organisations internal it-environment its probably better to keep them private and out of the public repositories.

To add a new domain with exercises just create a new yaml-file in /data folder and fill in the content in yaml-format such as:

```{bash, eval = FALSE} - id: extra_unique_id_for_this_particular_exercise domain: extra grade: easy lang_en: "How to shutdown R?" lang_fi: "Miten sammuttaa R?" lang_se: "Hur stänger du av R?" lang_ru: "Как выключить R?" lang_fr: "Comment arrêter R?" lang_nl: "Hoe wordt de R uitgeschakeld?" lang_de: "Wie man den R herunterfahren kann?" ans: q()

```

Once you re-build the package the new domain with new exercises is at your disposal!

Process as a gif



rOpenGov/edu documentation built on May 21, 2019, 2:26 a.m.