The advice is always NOT to use Microsoft Word to edit an R file. That stuff is poisonous. Microsoft word, typical of all Microsoft software, does not do what you tell it to do but helpfully does what it thinks you meant to ask it to do but were too dumb to do so.
Even notepad, gawdelpus, would be better. When I look at your script the first sign of trouble I see is: Error: unexpected input in: " s[1,3,k]<- (0.1) * runif(1)+ 0.1; s[1,1,k]<- (0.02) * runif(1)+ 0.98 ยจ" which is the spurious character Microsoft word has helpfully inserted to make it all look nice. It's downhill all the way from there. (R does not expect Microsoft Word, just as "nobody expects the Spanish Inquisition". See http://www.youtube.com/watch?v=CSe38dzJYkY). Bill Venables. -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of james198877 Sent: Tuesday, 21 June 2011 7:13 AM To: r-help@r-project.org Subject: [R] Unreasonable syntax error http://r.789695.n4.nabble.com/file/n3612530/PSC.r PSC.r Hi all, I just wrote a program in R by editing it in Microsoft Word and then pasting into the text editor of R. The above is the file. And below is what the console complains.... Why doesn't it recognise 'r'?? I have to mention that at least when I typed this first several lines into the console, the first error didn't appear. I don't try the next errors as there would be too many lines to type...I'm not sure if this is something about Word http://r.789695.n4.nabble.com/file/n3612530/lastsave.txt lastsave.txt Thanks a lot for your help!!! -- View this message in context: http://r.789695.n4.nabble.com/Unreasonable-syntax-error-tp3612530p3612530.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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. ______________________________________________ R-help@r-project.org mailing list 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.