1

In my conditional panel, I'm setting the inputs equal to a value that includes a single apostrophe in the word.

    conditionalPanel(
        condition = "input.mood == 'I'm Great'"
)

I've been getting this error on the UI webpage:

Uncaught SyntaxError: Unexpected identifier

Solutions tried: Back-slash

    conditionalPanel(
            condition = "input.mood == 'I\'m Great'"
)

Double Back-slash:

    conditionalPanel(
            condition = "input.mood == 'I\\'m Great'"
)

Paste0:

    conditionalPanel(
            condition = "input.mood == paste0("'I","'","m Great'")"
)

OR

    conditionalPanel(
            condition = "input.mood == 'paste0("I","'","m Great")'"
)

I don't believe I can call paste0 or paste within the condition.

GuyMister
  • 11
  • 1
  • I think the double backslash should work. Please post a complete code example - meaning, an entire minimal shiny app that shows the problem. It's difficult to give you a solution without reproducing your error. – DeanAttali Dec 14 '18 at 04:20

1 Answers1

0

This is untested code, but going off of this stack overflow example and your paste0, I think it should be something like this:

conditionalPanel(
        condition = paste0("input.mood == ", "'", "I","'","m Great", "'")
)

This is different from yours in that it brings the input.mood into the paste0 and it looks like your double quotes are all over the place.

rhavelka
  • 2,283
  • 3
  • 22
  • 36