Editing Text with Emacs

Emacs is the Unix text editor of choice because it has extensions to handle programming and typesetting. Start emacs from an xterm window by typing:
 emacs filename &
For beginners, the menu provides the most common commands. As one becomes more proficient, the control keys speed us up because our fingers need never leave the keyboard to grab the mouse. Emacs uses both the control key and the "Meta" key to combine with characters. On our workstations, the Meta key is marked with a diamond. M-x means hold down the diamond while typing x. Similarly, C-X means hold down Control and press x.


To download a windows version, follow these links, and choose the highest numbered version.
For Ubuntu, type sudo apt-get install emacs

To run stat packages from within emacs, see ESS: Emacs Speaks Statistics

Commands

Modes

Emacs tries to figure out what kind of file you are editing and tries to choose a mode which will make editing fit the file. Modes we use a lot are HTML, TeX (or LateX) and [for running R or Splus] ESS = Emacs Speaks Statistics, see ESS description. If you are writing a dissertation using lots of R code, SWeave is a handy way to organize R code inserts in a LaTeX document with automatic updating.

Data Entry

This page started as an intro to several stat packages. To run the demos on those packages, you will need to type the following data into a file and store it as 'tires.data'. (You may be able to copy it from this window using the mouse, thus avoiding all typing.)

45   162   372  |  83    161    97   |   55    233    206  |   88    119    64 
61   232   175  |  59    161    249  |   66    231    154  |   71    151    219
71   231   136  |  80    165    186  |   71    237    112  |   82    151    155
81   224    55  |  89    128    114  |   86    219     45  |   51    161    341
53   203   221  |  59    146    340  |   60    189    166  |   65    148    283
64   210   164  |  74    144    267  |   68    210    113  |   81    134    215
79   196    82  |  86    127    148  |   81    180     32  |   56    200    228
68   173   196  |  75    188    128  | 
Hold down the left mouse button and drag across the text, then move to your emacs window, click middle mouse button, and it should pop into the emacs window. To use the data, you need to make it into 3 columns, removing the vertical separators. Good practice for the keystrokes listed above. Go to the right of the 372 in line 1, use C-k to kill to end of line, press return, then C-y for yank. Just leave the separators for now, move over 3 columns and repeat until line 1 becomes:
45   162   372  
|  83    161    97   
|  55    233    206  
|  88    119    64 
Do the same for the other lines, then go back to the top of the file and use M-% to replace all | characters with nothing, or space. Save with C-x C-w (give it a name) or C-x C-s if it's already named, and you are done.
Information about Unix.
For more info about emacs, there is a guided tutorial in the help menu, or you can search for an html or video tutorial, there is lots of info out there.
Stat package demos:

Author: Jim Robison-Cox
Last Updated: Tuesday, 14-Jun-2011 16:52:23 MDT