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

Suggestions on examples #2

Closed
dracodoc opened this issue Mar 6, 2019 · 2 comments
Closed

Suggestions on examples #2

dracodoc opened this issue Mar 6, 2019 · 2 comments

Comments

@dracodoc
Copy link

dracodoc commented Mar 6, 2019

I've been writing Shiny apps in recent 2 years and learned a lot from scattered places. It will be great to have one book to include all the key ideas.

In my learning experience, I think some good examples can really help readers to understand the concept and apply to their own problems. I also would like to share some of tricks I think are very useful.

My first suggestion of example is based on my two answers in Stackoverflow -
Add weblink to actionButton, basically I used actionButton css class for a link, so a link will look like a button. Further more we can make a material button for a link. The key take away in this example is to print the tag function output, explore and set attributes properly.

In customizing css part, it's also worth mentioning the development tools within rstudio or chrome which can work on shiny app directly(you probably have this in mind already).

In reactivity part:

  • turning on options(shiny.trace = TRUE) is often very helpful(I found the reactive log is often overwhelming and less useful).
  • data.table modify variable by reference, so if user was using a data.table for reactive value, they need to set it to NULL then update value again to trigger reactive changes.
  • req is very useful to prevent unwanted error messages or behaviors. However req cannot be used inside data.table bracket like dt[req(var), .N], probably because when req returned Error it was not handled properly inside data.table. req has to be used outside of data.table call.
  • if the execution order of multiple reactive parts is not working as expected,freezeReactiveValue can be helpful (I found different priority settings never worked for me), but often there is a better design by choosing different reactive variables.

I also have to go through lots of trial and errors in using DT row selection to trigger app behavior, because the row selection event was the slowest in shiny app, which often create problem of updates order in reactive context. I can help to provide some example on this but not sure if there is a need for this kind of usage.

@Danieldavid521
Copy link
Contributor

I will have to check out these options

@hadley
Copy link
Owner

hadley commented Dec 9, 2020

Thanks for the comments. I think shiny.trace is probably not quite right for this audience, and I think the interaction of shiny and data.table probably deserves its own independent treatment. I'm tracking freezing inputs in #293.

@hadley hadley closed this as completed Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants