-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotgraph.R
39 lines (29 loc) · 941 Bytes
/
plotgraph.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#' Print a graph
#' @param name A search string
#' @return Plot
#' @export
plotgraph <- function(name) {
# locate all the shiny app examples that exist
validExamples <- list.files(system.file("graphs", package = "edgar"))
validExamplesMsg <-
paste0(
"Valid examples are:\n",
paste(validExamples, collapse = "\n"))
# if an invalid example is given, throw an error
if (missing(name) || !nzchar(name) ||
!name %in% validExamples) {
stop(
'Please run `plotgraph()` with a valid argument.\n',
validExamplesMsg,
call. = TRUE)
}
# find and launch the app
#appDir <- system.file("apps", name, package = "ShinyApps")
#shiny::runApp(appDir, display.mode = "normal", quiet = TRUE)
directory <- system.file("graphs/", package = "edgar")
#file_R <- ".R"
file_final <- paste(directory, name, sep = "/")
source(file_final)
showplot()
}
utils::globalVariables(c("showplot"))