Greg Minshall
2021-Jun-09 03:14 UTC
[R] Need help to fix the max date filter problem in the date input
Biplab, i'm not sure how to help you here, but this list pretty much runs on plain ASCII (or, these days, utf-8) e-mail. for the most part, without attachments. so, simply-formatted text, including code, with some mechanism in the code to initialize any data structures (data frames, matrices, etc.) needed for the example. some of this is described in the posting guide ---- https://www.r-project.org/posting-guide.html ---- formatting your e-mail in this way will likely increase your odds of a helpful reply. cheers, Greg
Biplab Nayak
2021-Jun-09 03:47 UTC
[R] Need help to fix the max date filter problem in the date input
Hi Greg, Please find the R Code in the word file attached here. Its plain text format Thanks & Regards Biplab Nayak On Wed, Jun 9, 2021 at 12:15 AM Greg Minshall <minshall at umich.edu> wrote:> Biplab, > > i'm not sure how to help you here, but this list pretty much runs on > plain ASCII (or, these days, utf-8) e-mail. for the most part, without > attachments. so, simply-formatted text, including code, with some > mechanism in the code to initialize any data structures (data frames, > matrices, etc.) needed for the example. > > some of this is described in the posting guide > ---- > https://www.r-project.org/posting-guide.html > ---- > > formatting your e-mail in this way will likely increase your odds of a > helpful reply. > > cheers, Greg >
Biplab Nayak
2021-Jun-09 12:02 UTC
[R] Need help to fix the max date filter problem in the date input
Hi Greg, Please find the objective of the code(bold) and code mentioned below. I was trying to do to achieve the below objective but somehow it's not working. 1.Order assessment based on the latest due date so select input automatically shows the order of assessment name. 2.Filter based on the one name or multiple names in the select input library(tidyverse) #library(stringr) # attached with tidyverse #library(readr) library(shiny) library(dplyr) ttclasses <- read_csv("~/tmp/ttclasses.csv") #Filter data ttclasses <-ttclasses %>% filter(str_detect(assessment, "Assignment")) *ttclasses <-ttclasses %>% filter(str_detect(name, "Name"))* ##Remove NA values. ttclasses <-ttclasses %>% drop_na("score") *## Sort assessment based on max due_date* *ttclasses <- ttclasses [order( - due_date, assessment ),]* #Convert to factor ttclasses$assessment <- factor(ttclasses$assessment) # please see the formats in help("strptime") ttclasses$due_date <- as.Date(ttclasses$due_date, format = "%m/%d/%y") *ttclasses$name <- factor(ttclasses$name)* # Define UI ---- ui <- fluidPage( # App title ---- titlePanel("Assessment Dashboard"), # Sidebar layout with input and output definitions ---- sidebarLayout( # Sidebar panel for inputs ---- sidebarPanel( # Input: Selector for variable to plot the grades for the selected # assignment ---- selectInput("assessment", "Assessment:", c("Assignment 1" = "Assignment 1", "Assignment 2" = "Assignment 2", "Assignment 3" = "Assignment 3", "Assignment 4" = "Assignment 4", "Assignment 5" = "Assignment 5")), selectInput("name", "Name:", ttclasses[,2]), dateRangeInput("due_date", "Due-Date:",start = max(ttclasses$due_date) , separator = " - ") ), # Main panel for displaying outputs ---- mainPanel( # Output: Plot of the requested variable against grade ---- plotOutput("gradePlot") ) ) ) # Define server logic to plot ---- server <- function(input, output) { output$gradePlot <- renderPlot({ grade_ad = input$assessment boxplot(ttclasses$score[ttclasses$assessment==grade_ad], frame.plot=FALSE, horizontal=TRUE, col="magenta", main=grade_ad) ttclasses <-ttclasses %>% filter(ttclasses$due_date >= input$due_date[1] & ttclasses$due_date <= input$due_date[2]) }) } # Create Shiny app ---- shinyApp(ui, server) Thanks & Regards Biplab Nayak On Wed, Jun 9, 2021 at 12:15 AM Greg Minshall <minshall at umich.edu> wrote:> Biplab, > > i'm not sure how to help you here, but this list pretty much runs on > plain ASCII (or, these days, utf-8) e-mail. for the most part, without > attachments. so, simply-formatted text, including code, with some > mechanism in the code to initialize any data structures (data frames, > matrices, etc.) needed for the example. > > some of this is described in the posting guide > ---- > https://www.r-project.org/posting-guide.html > ---- > > formatting your e-mail in this way will likely increase your odds of a > helpful reply. > > cheers, Greg >[[alternative HTML version deleted]]
Biplab Nayak
2021-Jun-09 12:06 UTC
[R] Need help to fix the max date filter problem in the date input
Hi Greg, Please find the objective of the code(bold) and code mentioned below. I was trying to do to achieve the below objective but somehow it's not working. 1.Order assessment based on the latest due date so select input automatically shows the order of assessment name. 2.Filter based on the one name or multiple names in the select input library(tidyverse) #library(stringr) # attached with tidyverse #library(readr) library(shiny) library(dplyr) ttclasses <- read_csv("~/tmp/ttclasses.csv") #Filter data ttclasses <-ttclasses %>% filter(str_detect(assessment, "Assignment")) ttclasses <-ttclasses %>% filter(str_detect(name, "Name")) ##Remove NA values. ttclasses <-ttclasses %>% drop_na("score") *## Sort assessment based on max due_date* ttclasses <- ttclasses [order( - due_date, assessment ),] #Convert to factor ttclasses$assessment <- factor(ttclasses$assessment) # please see the formats in help("strptime") ttclasses$due_date <- as.Date(ttclasses$due_date, format = "%m/%d/%y") ttclasses$name <- factor(ttclasses$name) Thanks & Regards Biplab Nayak On Wed, Jun 9, 2021 at 12:15 AM Greg Minshall <minshall at umich.edu> wrote:> Biplab, > > i'm not sure how to help you here, but this list pretty much runs on > plain ASCII (or, these days, utf-8) e-mail. for the most part, without > attachments. so, simply-formatted text, including code, with some > mechanism in the code to initialize any data structures (data frames, > matrices, etc.) needed for the example. > > some of this is described in the posting guide > ---- > https://www.r-project.org/posting-guide.html > ---- > > formatting your e-mail in this way will likely increase your odds of a > helpful reply. > > cheers, Greg >[[alternative HTML version deleted]]