Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStudio Project Template #6

Closed
howardbaik opened this issue Apr 11, 2024 · 3 comments
Closed

RStudio Project Template #6

howardbaik opened this issue Apr 11, 2024 · 3 comments
Assignees

Comments

@howardbaik
Copy link
Contributor

The goal is to give user the option to create a Quarto Based OTTR course with RStudio Project Templates.

The plan is to create a function in this repo, create_rstudio_project_template()

create_rstudio_project_template <- function(path, ...) {
  # ensure path exists
  dir.create(path, recursive = TRUE, showWarnings = FALSE)

 # For each file in the ottr repo,
 # Step 1. Collect inputs and paste together as 'Parameter: Value'
  dots <- list(...)
  text <- lapply(seq_along(dots), function(i) {
    key <- names(dots)[[i]]
    val <- dots[[i]]
    paste0(key, ": ", val)
  })

 # Step 2. Collect into single text string
  contents <- paste(
    paste(header, collapse = "\n"),
    paste(text, collapse = "\n"),
    sep = "\n"
  )

  # Step 3. Write to file
  writeLines(contents, con = file.path(path, "FILE_NAME_HERE"))
 
 # Repeat Steps 1~3 for each file
}

This way, we can accept user inputs inside an GUI and automatically setup an OTTR repo without having the user open a config file and manually configure things.

@howardbaik howardbaik self-assigned this Apr 11, 2024
@cansavvy
Copy link
Contributor

This is a great idea! It reminds me of a script and set up I started working on but haven't had a chance to totally get it working,

I called it "ottr-fying" a repo

See this script: https://github.com/jhudsl/ottr-reports/blob/main/scripts/ottr-fy.R

And here's its docs: https://www.ottrproject.org/ottr-fy.html

@cansavvy
Copy link
Contributor

Ideally we'd have functions like this for every type of repository and they would live in the ottrpal package

@howardbaik
Copy link
Contributor Author

howardbaik commented Apr 26, 2024

You are right. I should put this in the ottrpal package. See jhudsl/ottrpal#127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants