From 60aca98075f2734a1ba51d3545cf9fad9f4d44c9 Mon Sep 17 00:00:00 2001 From: Lextuga007 Date: Sat, 23 Mar 2024 15:50:32 +0000 Subject: [PATCH] Added how to reference a package and function in text, use of {styler} and {lintr} in code --- style-guides.qmd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/style-guides.qmd b/style-guides.qmd index ee3f73e..c10e743 100644 --- a/style-guides.qmd +++ b/style-guides.qmd @@ -114,6 +114,11 @@ HTML output: ```R x <- c(1:21) ``` +## Referencing R packages and functions in text + +Because a number of popular R packages use common names like janitor it can help distinguish the word refers to a package by using curly brackets: {janitor}. + +To highlight the use of a package in text using markdown formatting put function names in back ticks: `mutate()` along with rounded brackets. # Style Guide for code @@ -141,6 +146,12 @@ and [CC0](https://creativecommons.org/publicdomain/zero/1.0/) for text based pro >allows the creator to retain copyright whilst allowing others to copy and distribute and make use of their work non-commercially. The Creative Commons license also ensures creators get the recognition and credit for the work they produce and share. +## {styler}, {lintr} packages and tidyverse Style Guide + +It is highly recommended that code that is produced for and by NHS-R Community has {styler} applied to it as detailed in the [R for Data Science (2nd Edition)](https://r4ds.hadley.nz/workflow-style) and the [tidyverse style guide](https://style.tidyverse.org/index.html?q=styler#welcome). + +The use of the package {lintr} is also highly recommended and can show particular style issues that may not be automatically corrected through using {styler}. + # READMEs in repositories As standard all NHS-R GitHub repository READMEs should include the following text that refers to the Code of Conduct in this book: @@ -169,4 +180,4 @@ To create a code of conduct file use the code from the {usethis} package: use_code_of_conduct(contact = "nhs.rcommunity@nhs.net") ``` -which generates a file `CODE_OF_CONDUCT.md`. \ No newline at end of file +which generates a file `CODE_OF_CONDUCT.md`.