Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 540
info_seekeR Avatar asked Nov 10 '22 04:11

info_seekeR


1 Answers

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.

like image 54
Diego-MX Avatar answered Nov 15 '22 06:11

Diego-MX