[ESS] Viewing data frames

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Sun Feb 27 20:24:43 CET 2011


hi Sven,

Sven Hartenstein <lists at svenhartenstein.de> wrote:

> when I have a data frame and manipulate some colums, I often wish to
> check my coding by viewing the results. I am looking for an easy and
> comfortable way to do that when there are more columns than would fit
> in my emacs width.
> 
> I know there is edit() which opens the "R Data Editor", but when
> columns contain long strings, scrolling to the right beyond them does
> not work here. Also, it would be cool to be able to adjust the display
> width of columns (with the mouse).
> 
> Is there anything else that would make it easy to quickly view data
> frames? Quickly means: I do not want to write.table() and then import
> in some spreadsheed software.

It doesn't really solve your problem, but as a general reminder, you can
use ess-r-dired to view your objects.  (Described in the doc.)   

If you can make your Emacs window wide enough such that your data frame
will fit, then you should be able to just change what R thinks is the
default width:

  getOption("width")

It might be possible to get *R* to update  its current window width
from Emacs;  it can be gained quite easily from Emacs using the call:

  (window-width)

There is even a hook, window-configuration-change-hook, that we can
probably use to tell *R* to update the width option upon resize.  Would
anyone be interested inthat behaviour?

Finally, if your data frame is wider even that what you can view
width-wise on an Emacs window, you might just have to resort to saving
as .csv and then use something like csv-mode.el:

;;; csv-mode.el --- major mode for editing comma-separated value files

;; Copyright (C) 2003, 2004 Francis J. Wright

;; Author: Francis J. Wright <F.J.Wright at qmul.ac.uk>
;; Time-stamp: <23 August 2004>
;; URL: http://centaur.maths.qmul.ac.uk/Emacs/
;; Version: $Id: csv-mode.el,v 1.50 2004/08/23 17:51:26 fjw Exp $
;; Keywords: convenience

Stephen



More information about the ESS-help mailing list