logo
Tags down

shadow

r shiny observe function clears text input


By : user2174378
Date : October 18 2020, 08:10 AM
Any of those help I think the problem comes from the observe function. Each time you write a letter, it sends a request to your credential database. You should try to use ObserveEvent instead :
code :
shinyServer(function(input, output) {

observeEvent(input$login, {
z<-system(paste("perl", "/media/sf_umls-2018AA-full/2018AA-full/2018AA/META/umls_auth.pl",
                input$user, input$password),intern=TRUE)
if (grepl("false",z[22])) {
  renderText("incorrect login")
}
if (grepl("true",z[22])) 
{
  output$page <- renderUI({ ui2 })
  output$table <- renderTable({mtcars()})
}  })

})


Share : facebook icon twitter icon

Shiny - use results of function call in observe in output


By : Muneem Ahmed Khan
Date : March 29 2020, 07:55 AM
will be helpful for those in need observe does not return anything, but still it can create something. I solved this by assigning obj to global environment using <<- operator. In the server.R I have now:
code :
obj<<-AggregateData(TestData,Columns=input$source_columns)

How to observe individual input elements which were created in bulk in R Shiny


By : user3526747
Date : March 29 2020, 07:55 AM
wish helps you In case someone might bump into the same issue, here is my solution. Feel free to update it with a better answer if you have one.
code :
  minMax <- matrix(0, ncol(getData), 2)
  for(i in seq(ncol(getData))){
    if(!is.null(input[[paste0('column', i)]])){
    val <- input[[paste0('column', i)]]
    minMax[i,] <- val
    index <- which(getData[, i] %in% c(minMax[i, 1]:minMax[i, 2]))
    selectedSet <- getData[index, ]
  }
}

R/Shiny: how to use observe() to toggle data input


By : Rahul Makk
Date : March 29 2020, 07:55 AM
seems to work fine Have a look at the code below, that sort of work.
Unfortunately, as I was in full "debug mode", while I was experimenting I made more changes to your code than what was justified.
code :
library(shiny)

rm(list=ls()) 

## data31 (Historical data)
PeriodYear<-c(2009, 2010,2015,2016,2016,2017,2017,2017,2017,2017)
PeriodMon<-c("Jan","Apr","Jul","Sep","Dec","Jan","Feb","Mar","Apr","Apr")
YARD_ID<-c(33,25,47,13,64,24,26,36,34,89)
Value<-c(1,3,6,2,4,6,7,2,3,1)
dataall <- data.frame(PeriodYear,PeriodMon,YARD_ID,Value, 
                stringsAsFactors = F)
# dataall$PeriodMon<-as.character(dataall$PeriodMon)
data31<-dataall[which(dataall$PeriodYear!=2017 | dataall$PeriodMon!="Apr"),]

## data3c (current month)
data3c<-dataall[which(dataall$PeriodYear==2017 & dataall$PeriodMon=="Apr"),]
data3<-data31
current_year<-2017
current_mon<-"Apr"

# Define UI for application that draws a histogram
ui <- fluidPage(

  # Application title
  titlePanel("Data"),
  column(4,
  # Sidebar with a slider input for number of bins 
  selectInput("SelectedYear", "Choose a Year:", 
                 choices = 
                   c(2009,2010,2015,2016,2017))

  ,uiOutput("selectionMon"),

  uiOutput("selectionFY")
  ),
  column(8,
  # Show a plot of the generated distribution
  mainPanel(
    tableOutput("distPlot")
  )
) )


# Define server logic required to draw a histogram
server <- function(input, output, session) {

  observe({ 

    if (length(input$SelectedYear) == 0 | is.null(input$SelectedMon)  ) return()
    if(input$SelectedMon == "" ) return()

    data3 <<- data3 <- data31
    if (is.null(data3) | length(data3) == 0) return()
    isolate({

            Year_input <- input$SelectedYear
            Mon_input <- input$SelectedMon
            Id.Year <- which(current_year == Year_input)
            Id.Mon <- which(current_mon == Mon_input)
            if (length(Id.Year) > 0 & length( Id.Mon) > 0 ) data3<<-data3c

            }) # end isolate    
  })


  output$distPlot <- renderTable({

    head(dataselect()) 

  })

  ######## UI input of month #####
  output$selectionMon<-renderUI({

  if (length(input$SelectedYear) == 0 ) return()
    Mondata1<-data3[which(data3$PeriodYear==input$SelectedYear),]
    selectInput("SelectedMon", "Choose a Month:", 
                choices = names(table(data.frame(Mondata1$PeriodMon))))
  })
  ##### End of input of month ####

  ######## UI input of FeedYard #####
  output$selectionFY<-renderUI({
    if(length(input$SelectedYear) ==0 | length(input$SelectedMon) == 0 ) return()

    FYdata<-data3[which(data3$PeriodYear==input$SelectedYear & 
                          data3$PeriodMon==input$SelectedMon),]
    selectInput("SelectedFY", "Choose a ID:", 
                choices =names(table(data.frame(FYdata$YARD_ID))))

  })

  dataselect<-reactive({ 
    if(length(input$SelectedYear) ==0 | length(input$SelectedMon) == 0 | 
       length(input$SelectedFY) ==  0) return()
    isolate({
    data3[which(data3$PeriodYear==input$SelectedYear & 
                  data3$PeriodMon==input$SelectedMon & data3$YARD_ID==input$SelectedFY),]
  }) #end isolate

  })
  ##### 
}

shinyApp(ui = ui, server = server)

Using observe function in shiny R


By : suman babu
Date : March 29 2020, 07:55 AM
may help you . I don't really fully understand where the link is coming from and how the app looks since you didn't provide enough code (for example: what does it mean "variable in the UI"?). But here's a small example that shows how the javascript sends info to the server successfully. I'm using the shinyjs package which is a package I wrote.

Shiny observe event executing function as reactive


By : JPMPL
Date : March 29 2020, 07:55 AM
hop of those help? In my case, when I use observerEvent(), all things that introduce in this method change when some value changes. Shiny is an framework which utilizes reactive programming. In whatever case, you would use reactive(), to reutilize code and to have a clean code. If you use this variable and the value change, the value will change in all locations.
A solution to your problem, it could be to use observe() inside observerEvent(). Indeed, each time that the values of the intern code changes, the observe() will execute everything inside in it.
Related Posts Related Posts :
  • Subset rows based on "start and stop" strings
  • How to add a column to lists within a list without losing their names?
  • Plotting the means in ggplot, without using stat_summary()
  • R :Looping through each 5 rows of data frame and imputing incremental value
  • In R, is growing a list just as inefficient as growing a vector?
  • Flexdashboard, rhandsontable: how to programmatically access user updated table?
  • Creating Summary Table from R Variables
  • Average over groups and include previous groups
  • R: data.table count rows on specific columns > 0
  • Transform (shuffle) just 2 Fields in a Dataframe
  • Issue with replacing string by match in R
  • (very) Simple quantstrat trading model using logistic regression
  • R - count maximum number of consecutive dates
  • Problems using tidyr separate on "|"
  • Default value when calling a function in a for loop
  • Finding values in a matrix from list of values in R
  • count 0's in a zoo (or dataframe) object
  • Finding the first non-zero year in data frame for multiple variables using tidyverse
  • ggplot2 - how to assign geom_text with arrow icon to second yaxis scale
  • regex fails with dollar sign
  • Drop first element of list of lists, condense list of lists? Too many elements?
  • R - how to apply output of ifelse(str_detect ...) to whole group
  • caret package confusion matrix define positive case with multiple classes
  • Generating a pairwise 'distance' matrix
  • Change all R columns names using a reference file
  • In R & dabestr, how do I get grouped differences correctly?
  • Exclude or set a unique color to the bottom triangle of a correlation matrix heatmap
  • Split column by multiple delimiters, keeping delimiters
  • How to random search in a specified grid in caret package?
  • merge 2 data frames in a loop for each column in one of them
  • how to edit the codes for the summary of R S4 Object?
  • Remove specific rows in R
  • Flatten JSON list into data frame
  • Filtering a dataset and making a ggplot
  • Align cells vertically to be at the bottom flextable
  • R speed up sapply
  • invalid subscript type 'list' Azure Machine Learning
  • Use rollapply with xts object and an anonymous defined function
  • Isolate data frames from a spreadsheet to create a list
  • Error in xts, as.POSIXct "'order.by' cannot contain 'NA', 'NaN', or 'Inf'"
  • Column splitting in R
  • number similar/duplicated rows in R
  • Count the number of times each value appears in a row dataframe r
  • how to vectorise my code in r using for loop?
  • A function to fill in a column with NA of the same type
  • Network flow balancing constraint in R
  • Adding main titles from list to graphs in for loop
  • create a matrix in Perl or R if data is provided in CSV file
  • Passing column names as string to with
  • R - filtering rows and summing
  • How to change the order of fill aesthetic in faceted ggplot?
  • Function to remove outliers by group from dataframe
  • How to find the difference of max & min values in one group in a variable in a dataframe
  • Convert unicode to a readable string
  • Wrong scale/difficult to interpret times on time series object using 'ts'
  • Joining three numeric columns without adding them in r
  • Is there any way to extract the names of columns from an excel sheet without actually loading the sheet into the RAM?
  • case_when() not working: Error in mutate_impl(.data, dots)
  • Hide boxes if input not suitable in Shiny
  • Make nodes as images in R with visNetwork lib
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org