Skip to content

Commit

Permalink
updating the R help func
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaalbashir committed Oct 19, 2023
1 parent e2e1606 commit 8ea5e7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 8 additions & 7 deletions acro.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 6 additions & 0 deletions notebooks/test.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ acro_remove_output("output_3")
```{r}
acro_finalise("RTEST", "json")
```

## Use the help function

```{r}
acro_help("acro_pivot_table")
```

0 comments on commit 8ea5e7c

Please sign in to comment.