Helper functions needed in Julia

Helper functions needed for Julia

There are some really nice packages in R that need Julia ports. I really have been enjoying using Julia but it reminds me of Base R when I first started using it (e.g., pre-tidyverse). The easystats suite looks really nice and ripe for a port:

Like converting between odds ratios

oddsratio_to_riskratio.numeric <- function(OR, p0, log = FALSE, ...) {
  if (log) OR <- exp(OR)

  RR <- OR / (1 - p0 + (p0 * OR))

  if (log) RR <- log(RR)
  return(RR)
}

Could be

function oddsratio_to_riskratio(OR, p0, log = false)

  if log
    OR = exp(OR)
  end

  RR = OR / (1 - p0 + (p0 * OR))

  if log
    RR = log(RR)
  end

  return RR
end

Citation

BibTex citation:

@online{dewitt2022
author = {Michael E. DeWitt},
title = {Helper functions needed in Julia},
date = 2022-10-06,
url = {https://michaeldewittjr.com/articles/2022-10-06-julia},
langid = {en}
}

For attribution, please cite this work as:

Michael E. DeWitt. 2022. "Helper functions needed in Julia." October 6, 2022. https://michaeldewittjr.com/articles/2022-10-06-julia