From the course: Building Data Apps with R and Shiny: Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Printing to the R console in Shiny apps
From the course: Building Data Apps with R and Shiny: Essential Training
Printing to the R console in Shiny apps
- [Instructor] Let's take a look at how we can use the print function to debug our shiny apps and make them work. To do that, let's go to the exercise folder. We'll go to 0802, and we'll open up our R studio project. Okay, let's open the ui.r file and the server.r file. So in the server.r file, we can see we're using the function render plot, so we're going to be seeing a chart in our shiny app, and we're using the function curve on line six. Let me show you how that function works in the console. So we'll type curve, x to the power of two, from minus five to five. And let's run that code. And what we get back is a plot of the function x squared. Okay, so let's go over to the ui.r file to see what control we're using to change the value of the exponent input. So in line two through four, we can see we're using select input, so we're going to have a pull-down menu. Okay, that's great. Now let's run our shiny app and see it in action. So, as I expected, there's an error. We're not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.