can't find object - RShiny

Hello everybody. I have a problem for my first Shiny app. In the same reactive function (in the server part), I wrote this :


** for (j in 1:length(noms)){**
** if(dataz[1,j]==typeActifs[1]){**
** type1<-cbind(type1,j)**
** }**
** }**
** type1<-as.vector(type1)**

contr<-c(glue("minsumW[type1] = {input$contrainte_1}"), glue("maxsumW[type1] = {input$contrainte_2}")

However when I launch my apply, I got an error saying "can't find type1 object". Normally, the quotation marks are not a problem : when I use this exact same code in a regular R file (I mean, not a Shiny environment), the programm can read "type1" without any problem and everythings work perfectly.

I also tried :

contr<-c(glue("minsumW[{type1}] = {input$contrainte_1}"), glue("maxsumW[{type1}] = {input$contrainte_2}")

In this case the program is able to find the "type1" object but the results are not correct. I expect "contr" to be a vector containing 2 conditions, but in this case "contr" become a vector containing length(type1)*2 conditions.

The problem is that all objects values contained in "type1" are affected to input$contrainte_1. Or, this is the sum of all those values that are supposed to be affected to input$contrainte_1 (and input$contrainte_2).

I would like "type1" to be readed as a whole object by the program. Can somebody helps me ?

Thanks you for reading,



To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.