Skip to content

Commit

Permalink
add skeleton addin
Browse files Browse the repository at this point in the history
  • Loading branch information
aghaynes committed May 15, 2024
1 parent 2659874 commit 1c358e3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SwissASR
Title: Automated Completion of the SwissEthics Annual Safety Report
Version: 0.4.0
Version: 0.4.1
Authors@R:
c(person(given = "Alan G.",
family = "Haynes",
Expand Down
16 changes: 16 additions & 0 deletions R/asr_skeleton.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
asr_skeleton <- function(){

args <- formals(asr)

args$data <- "sae_data"

args <- lapply(1:length(args), function(x){
paste(names(args)[x], "=", deparse(args[[x]]))
}) |>
paste(collapse = ", \n ")

context <- rstudioapi::getSourceEditorContext()
id <- context$id
rstudioapi::insertText(text = paste0("asr(\n ", args, "\n)"), id = id)

}
4 changes: 4 additions & 0 deletions inst/rstudio/addins.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name: Add asr template
Description: Adds a template function call for the asr function to the current file.
Binding: asr_skeleton
Interactive: false

0 comments on commit 1c358e3

Please sign in to comment.