hello guys my name is khan and in today's video we will discuss that how we can use the date input functions in r shining so actually if i have already created a code file which you can see this code file for this video but before going forward i will be using this data set so i will open this data set and discuss that data set first so i have created a bit hypothetical data in which i have two date variables so this data is about u.s census so i have created two variables so here you can see that this date variable have a different format than the date 2 variable which is here so here we have day month and year whereas here we have year day sorry year month and day and the point here is that there is a divider between day month and year is the backslash or whereas here we don't have any divider between day month and year so let's see once we will import this data into r how it will react to these variable which data type these variables will get we will discuss this thing a bit in the start and then we will go then how you can use date input functions in r shiny let's go to the file that i have created so this is the file that i have created so this is the code file i will open up and then we will start discussing that how date variables and because i will suggest whenever you will
work with the dates be very careful because sometimes if you don't put much attention to the data variables you probably that can leads your analysis or your coding in a wrong way and it may give you the result which is not actually which are not according to the reality so I will expand it up
so this is the data set that i have shown you guys so let's see if i import this data set into our let's see how what are the variable type those variables got assigned let's control home control enter go back to my r so you can see the data i have assigned that data to a data object data so let's see if i want to see the variable here you can see that this date variable got assigned as a factor but in the other day two got assigned as an integer this variable got assigned as a factor because there was having a sub divider and it cannot be considered as numeric therefore are thought that it can be a factor variable whereas date 2 considered as the integer variable because it's more like a numeric variable there is no alphabetic character or you can say a punctuation mark so that's why it's considered as a numeric variable but while dealing with the date variable it's a good idea to consider it as a date variable so date format is also a kind of a numeric format you can you can if there is a variable which is a which is considered as a date you can even do submissions multiplication you can do numeric arithmetic operations over it but the date format is a bit different from the integer and especially when you will be doing time series analysis it have to be uh the date variable should have a date format in it so i will show you guys that how you can do that so go back to my data set so the first thing is that you guys have not that day two is an integer variable in order to convert it into a date format first what i will do there are many other ways that you can convert it back to date format but first i will do what i will do i will first convert it to a string format and in order to do that i will do i have used the as dot crafter and let's
#date #input #function #rshiny
R Shiny Playlist: • Learn Building R Shiny Dashboard with Us