problem with if-else in shiny

Hi everybody,
i am trying to do an app with shiny but i have a problem with if condition.
in input an user insert "spessore"
if this is 87.31 then it works, in output it gives me some information. If instead this is 87.16 then it doesn't give me information and in R I have this problem: Warning: Error in data.frame: object "thickness_fin" not found
1: shiny :: runApp
Warning: Error in renderText: object "thickness_fin" not found
96: renderText
95: func
82: renderFunc
81: output $ sentence
1: shiny :: runApp

To you a small excerpt:
if (spessore==87.16 || spessore==87.26 || spessore==87.31 || spessore==87.41 ||
spessore==87.66 || spessore==87.89 || spessore==87.99){
if(media>=1.25 && media<=1.5){
spessore_fin<-"Aggiungi 0.04"
}else if (media>=1.18 && media<1.25){
spessore_fin<-"Aggiungi 0.03"
}else if (media>=1.1 && media<1.18){
spessore_fin<-"Aggiungi 0.02"
}else if (media>=1 && media<1.1){
spessore_fin<-"Aggiungi 0.01"
}else if (media<=0.71){
spessore_fin<-"Riduci di 0.01"
}else {spessore_fin<-"Rimani invariato"}
}

Tahank you.

Hi, welcome!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at these resources, to see how to create one for a shiny app

https://mastering-shiny.org/action-workflow.html#getting-help

This is my guess because, as nirgrahamuk said, we don't have a reprex.

thickness_fin is not a variable in your code, but spessore_fin is. According to The Cambridge Dictionary, "spessore" is Italian for "thickness."

Your code may be improperly bilingual. See if there's a thickness_fin you need to replace with spessore_fin.

This topic was automatically closed 54 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.