[R] Viewing a data object

Horace Tso Horace.Tso at pgn.com
Wed Jun 13 19:35:33 CEST 2007


Stephen and Christophe,

I'm aware of fix and edit and the few issues with fix. Thus my reluctance to use them. Emacs may be the way to go, but from what I heard here it has a steep learning curve. The autocompletion feature in 2.5.1 is great. Andy Liaw points me to JGR which I'm just about to jump in.

I was hoping something like the head/tail function with a little more flexibility may also be useful to a lot of folks here.

vw = function( ...., location, nlines=10 ) {
     #'...' gives the string fragments that identify an object
     # location : 0.5 = middle, 0.25 = the first quartile, etc....
     # nlines : the number of lines to show
}

vw(Auro, 0.5)

returns the middle part of the first data frame it finds with name string starting with "Auro". This function should be easy to write with all thse regular expression functions.

Well, I'll save it for my Christmas wish list.

H.


>>> Stephen Tucker <brown_emu at yahoo.com> 6/12/2007 11:25 PM >>>
Hi Horace,

I have also thought that it may be useful but I don't know of any Object
Explorer available for R.

However, (you may alread know this but) 
(1) you can view your list of objects in R with objects(), 
(2) view objects in a spreadsheet-like table (if they are matrices or data
frames) with invisible(edit(objectName)) [which isn't easy on the fingers].
fix(objectName) is also a shorter option but it has the side effect of
possibly changing your object when you close the viewing data. For instance,
this can happen if you mistakenly type something into a cell; it can also
change your column classes when you don't - for example:

> options(stringsAsFactors=TRUE)
> x <- data.frame(letters[1:5],1:5)
> sapply(x,class)
letters.1.5.         X1.5 
    "factor"    "integer" 
> fix(x) # no user-changes made
> sapply(x,class)
letters.1.5.         X1.5 
    "factor"    "numeric" 

(3) I believe Deepayan Sarkar contributed the tab-completion capability at
the command line. So unless you have a lot of objects beginning with
'AuroraStoch...' you should be able to type a few letters and let the
auto-completion handle the rest.

Best regards,

ST


--- Horace Tso <Horace.Tso at pgn.com> wrote:

> Dear list,
> 
> First apologize that this is trivial and just betrays my slothfulness at
> the keyboard. I'm sick of having to type a long name just to get a glimpse
> of something. For example, if my data frame is named
> 'AuroraStochasticRunsJune1.df" and I want to see what the middle looks
> like, I have to type
> 
> AuroraStochasticRunsJune1.df[ 400:500, ]
> 
> And often I'm not even sure rows 400 to 500 are what I want to see.  I
> might have to type the same line many times.
> 
> Is there sort of a R-equivalence of the Object Explorer, like in Splus,
> where I could mouse-click an object in a list and a window pops up?  Short
> of that, is there any trick of saving a couple of keystrokes here and
> there?
> 
> Thanks for tolerating this kind of annoying questions.
> 
> H.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 



 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection.

______________________________________________
R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list