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

runDemo #212

Closed
hadley opened this issue Aug 14, 2013 · 4 comments
Closed

runDemo #212

hadley opened this issue Aug 14, 2013 · 4 comments

Comments

@hadley
Copy link
Member

hadley commented Aug 14, 2013

It would be useful if shiny had a runDemo function like this:

runDemo <- function(package, demo, ...) {
  path <- system.file("demo", demo, package = package)
  if (path == "") stop("Couldn't find demo ", demo, " in ", package, call. = FALSE)

  runApp(path, ...)
}

then you could easily run demos in installed packages:

runDemo("apps/basic", "gigvis")

That might almost be a better way to implement runExample():

runExample <- function(example, ...) runApp("shiny", example, ...)

although then you'd have to move the existing examples into the demo directory - this would be a good idea because it's fits the R package conventions a little better, and reduces the confusion between runExample() and example()

@alexbbrown
Copy link

I don't know whether it works like this now, but it would be great if you could cut n paste from a gist URL or GitHub URL into the first argument of such things.

-Alex Brown

On Aug 14, 2013, at 6:08 PM, hadley wickham [email protected] wrote:

It would be useful if shiny had a runDemo function like this:

runDemo <- function(package, demo, ...) {
path <- system.file("demo", demo, package = package)
if (path == "") stop("Couldn't find demo ", demo, " in ", package, call. = FALSE)

runApp(path, ...)
}
then you could easily run demos in installed packages:

runDemo("apps/basic", "gigvis")
That might almost be a better way to implement runExample():

runExample <- function(example, ...) runApp("shiny", example, ...)
although then you'd have to move the existing examples into the demo directory - this would be a good idea because it's fits the R package conventions a little better, and reduces the confusion between runExample() and example()


Reply to this email directly or view it on GitHub.

@dougmet
Copy link

dougmet commented Mar 2, 2016

Found this just before posting a similar issue. I think it would be nice to add a package argument to runExample. This would turn the following line:

shiny::runApp(system.file("shiny-examples", "basic", package="radarchart"))

into

shiny::runExample("basic", package="radarchart")

Happy to submit a PR if there's interest. The main thing is to agree on a standard directory to keep shiny examples. Here I've used shiny-examples, similar to this post but some use examples some use demo.

For me the name isn't important, but having this function as part of shiny would be a great way to encourage consistency.

@0tertra
Copy link

0tertra commented Nov 8, 2016

already added a pull request for this before looking into the issues.
You can find the request here #1458

@alandipert
Copy link
Contributor

Closing because dupe of #1458

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

No branches or pull requests

5 participants