-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Example skeleton project - DO NOT MERGE #701
Draft
nikolas-burkoff
wants to merge
5
commits into
main
Choose a base branch
from
skeleton_example@main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#' This function will be called when the user invokes | ||
#' the New Project wizard using the project template defined in the template file | ||
#' at: | ||
#' | ||
#' inst/rstudio/templates/project/teal_application.dcf | ||
#' | ||
#' It is exported so that projects can be created outside of the RStudio IDE | ||
#' | ||
#' @export | ||
project_skeleton <- function(path, use_cdisc = TRUE) { | ||
|
||
# ensure path exists | ||
dir.create(path, recursive = TRUE, showWarnings = FALSE) | ||
|
||
contents <- if (use_cdisc) { | ||
' | ||
library(teal) | ||
library(scda) | ||
|
||
adsl <- scda::synthetic_cdisc_data("latest")$adsl | ||
adtte <- scda::synthetic_cdisc_data("latest")$adtte | ||
|
||
# create data | ||
data <- cdisc_data( | ||
cdisc_dataset("ADSL", adsl), | ||
cdisc_dataset("ADTTE", adtte) | ||
)' | ||
} else { | ||
' | ||
library(teal) | ||
|
||
# create data | ||
data <- teal_data( | ||
dataset("IRIS", iris), | ||
dataset("MTCARS", mtcars) | ||
)' | ||
} | ||
|
||
contents <- paste(contents, | ||
"# create modules | ||
modules <- modules( | ||
example_module() | ||
) | ||
|
||
# create app | ||
app <- init( | ||
data = data, | ||
modules = modules | ||
) | ||
|
||
# run | ||
shinyApp(app$ui, app$server) | ||
", | ||
sep = "\n" | ||
) | ||
|
||
contents <- styler::style_text(contents) | ||
|
||
# write to index file | ||
writeLines(contents, con = file.path(path, "app.R")) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Binding: project_skeleton | ||
Title: Teal Application | ||
OpenFiles: app.R | ||
Icon: teal.png | ||
|
||
Parameter: use_cdisc | ||
Widget: CheckboxInput | ||
Label: Use CDISC data | ||
Default: On |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(in the future) Can the Widget be for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can only have the following:
We may want an addin to do the add modules part rather than at this project creation time. And for creating your own custom modules you could maybe? use snippets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is snippet a Rstudio-exclusive feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think snippet is RStudio exclusive feature (i.e. you can add code snippet on vscode too). However, the syntax will different.