Hi all, I have encountered a problem in some emails with invisible characters in code snippets that throw an error when pasted into the terminal window: Error: unexpected input in: "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, ?" This morning, after two hours of intense frustration, I found that I could reproduce this by typing code containing the above line into Kwrite, the text editor I use. When I pasted the code from Kwrite, it worked in the R terminal window. When I pasted it into a gmail message (set to Plain Text), copied that and pasted it into the R terminal window, I got the error. I was helping a young friend with one of those introductory R courses, but I have had this happen with other requests on the R help list. I thought that it was the fault of the fancy formatting in some emails, and could grumpily blame that, but this is worse as I can't seem to edit it out. Anybody else had this problem? I have sent a message to Gmail help. Jim
Hi again, I finally trapped the character (hexadecimal C2 capital A hat) with some low trickery. Jim On Mon, Nov 23, 2020 at 10:07 AM Jim Lemon <drjimlemon at gmail.com> wrote:> > Hi all, > I have encountered a problem in some emails with invisible characters > in code snippets that throw an error when pasted into the terminal > window: > > Error: unexpected input in: > "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, > ?" > > This morning, after two hours of intense frustration, I found that I > could reproduce this by typing code containing the above line into > Kwrite, the text editor I use. When I pasted the code from Kwrite, it > worked in the R terminal window. When I pasted it into a gmail message > (set to Plain Text), copied that and pasted it into the R terminal > window, I got the error. I was helping a young friend with one of > those introductory R courses, but I have had this happen with other > requests on the R help list. I thought that it was the fault of the > fancy formatting in some emails, and could grumpily blame that, but > this is worse as I can't seem to edit it out. Anybody else had this > problem? I have sent a message to Gmail help. > > Jim
On Mon, 23 Nov 2020 10:07:42 +1100 Jim Lemon <drjimlemon at gmail.com> wrote:> Hi all, > I have encountered a problem in some emails with invisible characters > in code snippets that throw an error when pasted into the terminal > window: > > Error: unexpected input in: > "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, > ?" > > This morning, after two hours of intense frustration, I found that I > could reproduce this by typing code containing the above line into > Kwrite, the text editor I use. When I pasted the code from Kwrite, it > worked in the R terminal window. When I pasted it into a gmail message > (set to Plain Text), copied that and pasted it into the R terminal > window, I got the error. I was helping a young friend with one of > those introductory R courses, but I have had this happen with other > requests on the R help list. I thought that it was the fault of the > fancy formatting in some emails, and could grumpily blame that, but > this is worse as I can't seem to edit it out. Anybody else had this > problem? I have sent a message to Gmail help.(1) Don't use Kwrite (whatever that is) --- use vi[m] like civilised ( :-) ) people do. It's even available for Windoze. Yes, there is a steep learning curve, but once you've climbed it you'll never look back. (And for what it's worth, the curve is not as steep as that for emacs!!! :-) ) (2) The function tools::showNonASCII might be helpful to you. cheers, Rolf -- Honorary Research Fellow Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
On 11/22/20 5:20 PM, Rolf Turner wrote:> On Mon, 23 Nov 2020 10:07:42 +1100 > Jim Lemon <drjimlemon at gmail.com> wrote: > >> Hi all, >> I have encountered a problem in some emails with invisible characters >> in code snippets that throw an error when pasted into the terminal >> window: >> >> Error: unexpected input in: >> "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, >> ?" >> >> This morning, after two hours of intense frustration, I found that I >> could reproduce this by typing code containing the above line into >> Kwrite, the text editor I use. When I pasted the code from Kwrite, it >> worked in the R terminal window. When I pasted it into a gmail message >> (set to Plain Text), copied that and pasted it into the R terminal >> window, I got the error. I was helping a young friend with one of >> those introductory R courses, but I have had this happen with other >> requests on the R help list. I thought that it was the fault of the >> fancy formatting in some emails, and could grumpily blame that, but >> this is worse as I can't seem to edit it out. Anybody else had this >> problem? I have sent a message to Gmail help. > (1) Don't use Kwrite (whatever that is) --- use vi[m] like civilised > ( :-) ) people do. It's even available for Windoze. Yes, there is > a steep learning curve, but once you've climbed it you'll never look > back. (And for what it's worth, the curve is not as steep as that for > emacs!!! :-) ) > > (2) The function tools::showNonASCII might be helpful to you.Thunderbird on Ubuntu displays it ats: "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, followed by a line feed and then a diamond with a question-mark and a closing double-quote. library(tools) showNonASCII("star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, + ?") 1: star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, <ef><bf><bd> -- David.> > cheers, > > Rolf >
I have no idea what everyone's talking about. What invisible character???? The black triangle triangle with a question mark renders fine in (my) gmail. And it's a unicode character used when there was a problem reading (presumably text) data. https://en.wikipedia.org/wiki/Specials_(Unicode_block) If I copy and paste it into R, it's replaced by a regular question mark. On Mon, Nov 23, 2020 at 12:18 PM Jim Lemon <drjimlemon at gmail.com> wrote:> > Hi again, > I finally trapped the character (hexadecimal C2 capital A hat) with > some low trickery. > > Jim > > On Mon, Nov 23, 2020 at 10:07 AM Jim Lemon <drjimlemon at gmail.com> wrote: > > > > Hi all, > > I have encountered a problem in some emails with invisible characters > > in code snippets that throw an error when pasted into the terminal > > window: > > > > Error: unexpected input in: > > "star_wars_matrix<-matrix(box_office,nrow=3,byrow=TRUE, > > ?" > > > > This morning, after two hours of intense frustration, I found that I > > could reproduce this by typing code containing the above line into > > Kwrite, the text editor I use. When I pasted the code from Kwrite, it > > worked in the R terminal window. When I pasted it into a gmail message > > (set to Plain Text), copied that and pasted it into the R terminal > > window, I got the error. I was helping a young friend with one of > > those introductory R courses, but I have had this happen with other > > requests on the R help list. I thought that it was the fault of the > > fancy formatting in some emails, and could grumpily blame that, but > > this is worse as I can't seem to edit it out. Anybody else had this > > problem? I have sent a message to Gmail help. > > > > Jim > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.