info_seekeR
info_seekeR

Reputation: 1326

Unexpected input error in Shiny, but unable to locate the source of error

I am getting the unexpected input error in UI.R, as follows:

ERROR: C:\Users\myApp/ui.R:1:2: unexpected input 
1: ï»

However, when I try to locate the error at line 1, there is absolutely nothing of the form ï».

To resolve this error, I tried saving my UI.R file as a text file and changing the encoding to UTF-8, but this still does not remove the strange character. I also tried removing the first couple of lines and re-writing the code, but it still gives the same error!

How can I remove this character? Should I use another text editor? I am using base R, not R Studio. And I had copy-pasted my code form my GitHub account, if that info is required... Code from my file can be viewed here.

Many thanks.

Upvotes: 5

Views: 2415

Answers (1)

Diego-MX
Diego-MX

Reputation: 2339

I have this same issue in the year '19, and took me a while to run into this question from the year '14.

Not Shiny, but a regular R project with its .Rprofile.

The solution that worked for me is:

Open your file in Notepad++. From the Encoding menu, select Convert to UTF-8 (without BOM), save the file, replace the old file with this new file. And all is fixed.

Upvotes: 1

Related Questions