• The Surgical Informatics Cookbook
  • 1 Introduction
    • 1.1 How to contribute
    • 1.2 Indexing
      • 1.2.1 Index
      • 1.2.2 Chapter and section references
      • 1.2.3 Figure and table references
      • 1.2.4 Citations
  • 2 Snippets
    • 2.1 Useful RStudio functions
      • 2.1.1 Clean restart
      • 2.1.2 Remove duplicated packages between personal and system libraries
      • 2.1.3 Remove large file accidentally committed to git
    • 2.2 Memory and efficient RAM usage
    • 2.3 Exporting tables that work in both PDF and Word
      • 2.3.1 Warning in kableExtra. Please specify format in kable. kableExtra can customize either HTML or LaTeX outputs.
    • 2.4 Creating Reproducible R Examples to Share in the Group (binder, holepunch and docker)
      • 2.4.1 Create Basic Reproducible Examples
      • 2.4.2 holepunch - Complex Reproducible Examples
    • 2.5 Working with CHIs
      • 2.5.1 chi_dob() - Extract date of birth from CHI
      • 2.5.2 chi_gender() - Extract gender from CHI
      • 2.5.3 chi_age() - Extract age from CHI
      • 2.5.4 chi_valid() - Logical test for valid CHI
    • 2.6 Working with dates
      • 2.6.1 Difference between two dates
      • 2.6.2 Lags
      • 2.6.3 Pulling out “change in status” data
      • 2.6.4 Guess the Format of Dates
      • 2.6.5 Isoweek and epiweek
    • 2.7 Labelling tables and figures in markdown chunks
      • 2.7.1 Plots
      • 2.7.2 Tables
    • 2.8 Join tables and overwrite values (that are often missing)
    • 2.9 Read in multiple files
    • 2.10 Averaging multiple AUCs (say from imputed datasets)
    • 2.11 Formating thousands automatically
    • 2.12 DataTable function
  • 3 Data manipulation
    • 3.1 Collapse multiple “no” and “yes” options
    • 3.2 Filtering best practice
      • 3.2.1 From Jamie Farrell
    • 3.3 Filter NA: Dropping rows where all specified variables are NA
    • 3.4 Vectorising rowwise procedures
    • 3.5 Multiple imputation and IPW for missing data
      • 3.5.1 Data
      • 3.5.2 Multiple imputation
      • 3.5.3 IPW
  • 4 Machine learning
    • 4.1 Deep learning
      • 4.1.1 Pulling images from REDCap directly to argodeep
  • 5 Data Transfer and Eddie
    • 5.1 Uploading and Downloading Data the Easy Way
    • 5.2 Alternative Methods when the Easy Way won’t work
      • 5.2.1 What is Eddie?
    • 5.3 Using the Command Line
      • 5.3.1 Downloads and Setup - Eddie Example
      • 5.3.2 Copy and Paste with PuTTY
      • 5.3.3 Closing a Session in PuTTY
      • 5.3.4 Eddie File Structure
    • 5.4 Copying Data from Eddie into RStudio server
      • 5.4.1 Method 1: Using PuTTY (or another terminal/shell connected to Eddie)
      • 5.4.2 Method 2: Using the RStudio Server Terminal
    • 5.5 Group Folders on Eddie and DataStore
      • 5.5.1 The Scratch Space
      • 5.5.2 DataStore
      • 5.5.3 Running Eddie from RStudio Server
      • 5.5.4 Modules (Applications) in Eddie
      • 5.5.5 Working with R in Eddie
      • 5.5.6 Specific R Package Versions
      • 5.5.7 General Eddie Etiquette
    • 5.6 Additional Resources
    • 5.7 Using RStudio directly in Eddie
    • 5.8 Configuring Python Deep Learning Environment in Eddie
      • 5.8.1 Package installation
      • 5.8.2 GPU usage
    • 5.9 Configuring Jupyter Notebook Access
  • 6 Plotting
    • 6.1 Plotting distributions of proportions across multiple different variables
    • 6.2 GGHighlight Example
    • 6.3 coord_flip() factor orders
    • 6.4 Axis font size
    • 6.5 Shorten Arrows on a DAG
  • 7 Genomics
    • 7.1 Single Cell Analysis
      • 7.1.1 Minimising the size of a Seurat Object
    • 7.2 Nextflow
      • 7.2.1 RNASeq example with sbatch (slurm)
      • 7.2.2 DNASeq example with sbatch (slurm)
      • 7.2.3 ATACSeq example with sbatch (slurm)
  • 8 Programming in rlang
    • 8.1 rlang
      • 8.1.1 What is rlang?
      • 8.1.2 Dynamic calling of variables using dplyr
  • 9 Server admin
    • 9.1 RStudio (argonaut and argosafe)
      • 9.1.1 Scheduled script (CRON)
    • 9.2 RStudio Connect: argoshare
      • 9.2.1 Delete user
    • 9.3 Shiny server opensource setup - UoE Eleanor
      • 9.3.1 Setting up Ubuntu Instance
      • 9.3.2 Install Nginx
      • 9.3.3 Installing R
      • 9.3.4 Installing Shiny Server
      • 9.3.5 Installing other Linux packages
      • 9.3.6 Installing R packages
      • 9.3.7 Loading your app
      • 9.3.8 Make your app the default index page
      • 9.3.9 Getting a user-friendly domain name
      • 9.3.10 Appendix 1 – Password protecting your site
      • 9.3.11 APPENDIX 2 – Setting up a swap file
  • 10 REDCap
    • 10.1 API pull
    • 10.2 Applying a REDCap factoring script
    • 10.3 Alternative to the factoring script: redcap_label() from library(collaboratorR)
    • 10.4 Scannable barcodes in REDCap
  • 11 Working with digital pathology data and python
    • 11.1 Installing OpenSlide
    • 11.2 Using OpenSlide
      • 11.2.1 Opening a slide and inspecting properties
    • 11.3 Whole workflow
    • 11.4 Using python and R together
    • 11.5 Handling errors in python
    • 11.6 Iterating over many many slide files
  • 12 Citations with R Markdown
    • 12.1 Zotero Set-up
    • 12.2 File Storage Set-up
    • 12.3 Folder Set-up
      • 12.3.1 Storing PDFs
      • 12.3.2 Storing Bibliographies
      • 12.3.3 Subfolder for References
    • 12.4 Configuring Zotero
      • 12.4.1 ZotFile PDF Preferences
      • 12.4.2 General Zotero Settings
      • 12.4.3 Refresh BibTex Citation Key
    • 12.5 Generating a .bib File
    • 12.6 Linking DropBox and Rstudio Server
      • 12.6.1 Token Creation
      • 12.6.2 DropBox Linkage
    • 12.7 Citing R Packages
  • References
  • Published with bookdown

The Surgical Informatics Cookbook

The Surgical Informatics Cookbook

Surgical Informatics, University of Edinburgh

2025-02-27