Re: [ESS] how to edit openbugs model file?

2016-12-05 Thread Paul Johnson
Thanks, everybody.  I'm taking the suggestion Martin offered, since
this thing is required to be named *.txt in the current OpenBUGS.

Solution

Put this at the end of the *.txt file:

# Local Variables:
# mode: R
# End:

That works.

This question was raised by an interesting problem. This might be a
useful a warning to others using Emacs and OpenBugs.  Punch line:
character encoding must be ASCII.

The student typed in a bugs model file on his system, using Emacs.
The default character encoding was set as UTF8. Then his model files
kept crashing OpenBugs and I could not understand why. It warned about
unfamiliar characters,  I kept checking to see that file encoding was
UTF8.

Doh! Then I remembered that OpenBUGS asks for ASCII files!  Symbols
like "*" and "~" are given different encoding in ASCII and UTF8. The
"~" looks exactly the same, whether ASCII or UTF8, but luckily for us,
that student's computer showed the UTF8 "*" as a highlighted character
that was in a different line position.

If you put the cursor on a character and run C-u C-x =, then you see a
nice display about the encoding. There's an especially helpful post
about it:
http://stackoverflow.com/questions/10500323/how-to-see-the-files-encoding-in-emacs.

>From within Emacs, I cannot replicate that problem that the student
generated. No matter how I set buffer-file-encoding-system, I get
ASCII whenever I type "*" or "~". I'm guessing that because the
student is from another country, and English is not his native
language, that his Locale is different somehow.  But I can't see
what's different about it. Interesting and frustrating!

pj

On Sat, Dec 3, 2016 at 8:40 AM, Sparapani, Rodney  wrote:
> Hi Paul:
>
> Use BUGS mode which is part of ESS…
> (require ‘ess-bugs-d)
>
> Then name your file model.bug
>
> Rodney
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: [ESS] how to edit openbugs model file?

2016-12-03 Thread Sparapani, Rodney
Hi Paul:

Use BUGS mode which is part of ESS…
(require ‘ess-bugs-d)

Then name your file model.bug

Rodney

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: [ESS] how to edit openbugs model file?

2016-12-03 Thread Martin Maechler
Also,
   M-x R-mode
but that would need to be done again every time...
If you don't want to rename to model.R
Add a line

## -*- R -*-

at the top (or close enough to the very top; this tells emacs to use
R-mode ;  there are several (more flexible, more to write) versions of
such so-called  "file local variables" in emacs.. Emacs manuals and
also Google "Emacs file local variables"  should help.

Martin Maechler,
ETH Zurich



On Fri, Dec 2, 2016 at 8:35 PM, Simon Bonner  wrote:
> Hi Paul,
>
> An easy way to do this is to rename your file as model.R. The syntax for BUGS 
> is almost identical to the syntax for R, and BUGS doesn’t care what the model 
> extension is.
>
> Wish I could say that I thought of that but kudos go to Matthew Schofield.
>
> Cheers,
>
> Simon
>
> Simon Bonner
> Assistant Professor of Environmetrics/Director MMASc
> Department of Statistical and Actuarial Sciences/Department of Biology
> University of Western Ontario
>
> Office: Western Science Centre rm 276
>
> Email: sbonn...@uwo.ca | Telephone: 519-661-2111 x88205 | Fax: 519-661-3813
> Twitter: @bonnerstatslab | Website: http://simon.bonners.ca/bonner-lab/wpblog/
>
>
> On 2016-12-02, 1:21 PM, "ESS-help on behalf of Paul Johnson" 
>  wrote:
>
> I have a student here who wants to edit an OpenBugs file named
> "model.txt" in Emacs. I can't understand how to tell Emacs to use a
> bugs mode so that things like M-; understand what to do.
>
> If you have an idea, let me know.
>
> We don't want to run the bugs code with an emacs session, we just want
> to edit the bugs text model file and then we can run with R2OpenBugs
> or something else.
>
> --
> Paul E. Johnson   http://pj.freefaculty.org
> Director, Center for Research Methods and Data Analysis 
> http://crmda.ku.edu
>
> To write to me directly, please address me at pauljohn at ku.edu.
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help