12. Dynamic UI (User Interface) in R Shiny

preview_player
Показать описание
hello guys my name is khan and actually in this video we will make about this kind of dashboard so as you can see that even in that in that dashboard we have titled it like that we will construct a dynamic user interface so what does it mean by dynamic so as you guys have noticed in my previous video that whenever you are selecting any options in our user interface our main panel got updated accordingly but in this video i will show you guys that how you if you select any value in user interface it updates the other cells value so in this example what i will be doing actually in this video we will be doing two data sets uh completely different from each other one data set is related to cars and the second data set is related to employment so as you can see that currently i have selected the car data and i have so here we can see that it's saying select x axis for this graph so you can select it so i can select any other variable and you can see that the graph got updated and the same as we have y axis which is also contains the variable names which are coming from this car data and if i select it it will update it but suppose if i change my data so there are two options the card underscore data and the employment suppose if i select employment underscore data so if you see here now there are three variables because there are three variables under employment data my slack input boxes got updated according to the data i have selected here so that's why we call that kind of phenomena as a dynamic user interface that our values within our user interface got updated according to the options you have selected within the user interface and and previously we all we already know that we were creating dynamic main panel but this time we were also creating a dynamic user interface so in order to show you guys that how you can create a dynamic user interface so i will start constructing uh my r code file just from the scratch and we will be using again the shiny library so i will just close this window

so I will open a studio from where we will start making our

dashboard from scratch so I will open our script I'll just open it into a separate window and from here we'll start writing down our code just from scratch so the first thing that I will do I will call the library that I will be using so for this code I will be using just shiny library

library shiny

this is the library that you guys will be using enter so and the second thing that I would like to do I will set my working directory where my data sets will be located as I told you guys before that we will be using two data sets for this video uh

good my dynamic user interface these are the two data sets that we will be using I can even open it up for you guys to show what kind of so as you can see the card data contains price mpg and these variables whereas if I go to the other data size the employment underscore data it contains only three variables year employment and population I will close it down too so what I will do I will just copy the path of that folder where my data sets are located there is a set

a working directory within that I'll be pasting the path again I don't need to mention the file name because I just want to mention the folder part

so okay I have uh already uploaded the shiny library the next thing will be that we will as always we will be defining the first user interface you don't need to define the user interface cost but I really like to start from the user interface creating an object UI again you can name whatever you want to do whatever you want to give this object so then I will be first using the shiny function which is shiny UI actually I think we because it's not working properly because I have to adjust this a because when I pasted this path r will not recognize until I convert these slashes into forwarding

slashes and it's better to save this file too so again I will be using it within my shine

and I will be using I'm using a folder dynamic UI

like dynamic

UI so I will be using the shiny UI function and within that, I will be using the fluid page I think in most of my videos I will use the fluid page and within the fluid page the first thing you will define is the title uh the title panel which will be containing the title of our dashboard title panel and after that so what's the title I want to give I want to write down here it has we will construct dynamic UX construct
#DYNAMIC #UI #RSHINY

Рекомендации по теме