From 8ea5e7c10640588c42bcc3d3620f8fb97c030fde Mon Sep 17 00:00:00 2001 From: mahaalbashir Date: Thu, 19 Oct 2023 11:18:21 +0100 Subject: [PATCH] updating the R help func --- acro.R | 15 ++++++++------- notebooks/test.Rmd | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/acro.R b/acro.R index fd6d367..ab57296 100644 --- a/acro.R +++ b/acro.R @@ -119,14 +119,15 @@ acro_finalise <- function(path, ext) ac$finalise(path, ext) } -acro_help <- function(command) +acro_help <- function(command, family="") { "Get the help documentation of the functions" - if (command == "acro_table") { - command = "crosstab" - } else { - command = str_remove(command, "acro_") - } + # mapping the r commands to their corresponding python commands + command_map <- c("acro_table" = "crosstab", "acro_lm" = "olsr", + "acro_glm" = ifelse(family %in% c("", "logit"), "logitr", "probitr")) + + # get the command + command <- ifelse(command %in% names(command_map), command_map[command], sub("acro_", "", command)) command <- ac[[command]] py_help(command) - } +} diff --git a/notebooks/test.Rmd b/notebooks/test.Rmd index a811334..6c68a2a 100644 --- a/notebooks/test.Rmd +++ b/notebooks/test.Rmd @@ -148,3 +148,9 @@ acro_remove_output("output_3") ```{r} acro_finalise("RTEST", "json") ``` + +## Use the help function + +```{r} +acro_help("acro_pivot_table") +```