## Right-to-Left Shunt

Right-to-left shunt fraction Estimated using an arterial blood gas measurement after inspiring 100% oxygen for about 20 minutes. library (ggplot2) library(reshape2) #to melt library(plotly) Main function Calculates the $$\frac{Q_s}{Q_t}$$ shunt fraction rl.shunt <- function (po2, pco2, temp, altitude){ if (missing(temp)) {temp <- 37} if (missing(altitude)) {altitude <- 1300} #MCS altitude p.water <- 47 * exp((temp-37)/18.4)…

## Toy datasets with random NAs

Simulated (toy) datasets are very helpful to test data analysis tools and various other functions or transformations. For example, inserting random blanks (NAs) may allow testing imputation procedures. I have created a function to quickly insert NAs into a vector, that can be used across rows, columns, or on the whole data frame with one…