A series of shiny modules to help shiny sense the world around it.
It's called shinysense
because shinyinputs
seemed kinda lame.
shinysense
is not currently on CRAN. To install it use the devtools
github function.
devtools::install_github("nstrayer/shinysense")
Once the app is installed just included it in your shiny app the way you usually would:
#my super cool shiny app
library(shiny)
library(shinysense)
There currently is no website for the documentation to reside in, but all the functions are documented. To figure out how to use these see the demo code posted below or just in R do the standard documentation search.
#I have no idea how these ridiculous functions work!
?shinydrawr
?shinydrawrUI
#oh, I still have no idea.
Embeds a card that can be swiped in different directions, the swipe direction is returned to shiny. Demo. Code
- Used in our app
papr
.
# ui.R
shinyswiprUI(
"quote_swiper",
div(
# Content can be any ui elements you want.
textOutput("quote")
)
)
# server.R
# Reactive function containing swipe direction as character
# card_swipe() == 'Up' etc.
card_swipe <- callModule(shinyswipr, "quote_swiper")
Draws a line chart that obscures the end of the results, the user then draws what they think the rest of the chart is and then the rest of the chart is revealed. Demo. Code.
- See this blog post on how to use draw charts inside and outside of shiny.
- Blatently stolen from the New York Times article You Draw It: What Got Better or Worse During Obama’s Presidency.
# ui.R
shinydrawrUI("outbreak_stats")
# server.R
drawChart <- callModule(
shinydrawr,
"outbreak_stats",
data = data,
draw_start = cutoff,
x_key = "time",
y_key = "metric"
)
Records audio on a button press and returns the fast-fourier transformed signal to the server.
# ui.R
shinyearrUI("my_recorder")
# server.R
recorder <- callModule(shinyearr, "my_recorder")
Record images from a webcam.
#ui.R
shinyviewrUI("myCamera", height = '200px'))
#server.R
myCamera <- callModule(shinyviewr,"myCamera", outputWidth = 500, outputHeight = 500)
Capture and return accelerometer data from your phone or tablet.
# ui.R
shinymovrUI("movr_button")
# server.R
movement <- callModule(
shinymovr, "movr_button",
time_limit = 2,
recording_message = "RECORDING!"
)
shinypopup
: A lot of times when you're developing an app using the above senses you need to let your user's know you're collecting their data. This module creates a popup that obscures a given section of your app that forces the user to accept your terms before they can go any further.
The probability of there being bugs in these functions is unfortunately high. If you've found one I would be delighted if you could file a new issue here. I'll try my best to at least respond.