{"id":1973,"date":"2021-03-08T03:10:55","date_gmt":"2021-03-08T03:10:55","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=1973"},"modified":"2021-03-08T14:19:17","modified_gmt":"2021-03-08T14:19:17","slug":"tidyx-51-building-statistical-models-into-shiny-apps","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/tidyx-51-building-statistical-models-into-shiny-apps\/","title":{"rendered":"TidyX 51: Building Statistical Models into Shiny Apps"},"content":{"rendered":"<p>We&#8217;ve done a fair bit of {shiny} over the past year, detailing different approaches to provide an interactive data environment for end users. However, one thing we haven&#8217;t done yet is talk about embedding statistical models into your {shiny} apps. This week, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/twitter.com\/ellis_hughes\">Ellis Hughes<\/a><\/span><\/strong> and I do just that.<\/p>\n<p>We create a random forest classifier, which uses body size features to predict the probability that a penguin is one of three different species and embed this into a {shiny} web app. For this, we will be using the <strong>penguins <\/strong>data set form the {palmerpenguins} R package.<\/p>\n<p>In addition to from making an interactive statistical app, we cover a few other nuances of {shiny} app development:<\/p>\n<ul>\n<li>Organizing the user components horizontally across the top of the app versus the commonly used sidebar panel.<\/li>\n<li>How to increase the size and width of the plot in the main panel.<\/li>\n<li>How to center the plot within in the main panel.<\/li>\n<li>How to add a title to the top of your {shiny} app.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1974\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM-1024x863.png\" alt=\"\" width=\"625\" height=\"527\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM-1024x863.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM-300x253.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM-768x647.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM-624x526.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-07-at-7.07.17-PM.png 1808w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>To watch our screen cast, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/www.youtube.com\/watch?v=B5DfV_8IJtA\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n<p>To access our code, <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/thebioengineer\/TidyX\/blob\/master\/TidyTuesday_Explained\/051-Deploying_Shiny_Models\/shiny_statistical_model.R\">CLICK HERE<\/a><\/span><\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve done a fair bit of {shiny} over the past year, detailing different approaches to provide an interactive data environment for end users. However, one thing we haven&#8217;t done yet is talk about embedding statistical models into your {shiny} apps. This week, Ellis Hughes and I do just that. We create a random forest classifier, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-1973","post","type-post","status-publish","format-standard","hentry","category-tidyx-screen-cast"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/comments?post=1973"}],"version-history":[{"count":1,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1973\/revisions"}],"predecessor-version":[{"id":1975,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1973\/revisions\/1975"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=1973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=1973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=1973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}