[R] Odp: Object Browser

Petr PIKAL petr.pikal at precheza.cz
Mon Sep 27 10:04:08 CEST 2010


Hi
I noticed that nobody answered your question yet so here is my try.

If you want to see what objects are in your environment you can use ls() 
but its output is only names of objects. Here is a function I use a long 
time for checking what objects are there, their type, size and possibly 
rows columns. You can modify it to give you some more info but usually it 
is not needed.

Regards
Petr

ls.objects <- function (pos = 1, pattern, order.by) 
{
    napply <- function(names, fn) sapply(names, function(x) fn(get(x, 
        pos = pos)))
    names <- ls(pos = pos, pattern = pattern)
    obj.class <- napply(names, function(x) as.character(class(x))[1])
    obj.mode <- napply(names, mode)
    obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class)
    obj.size <- napply(names, object.size)
    obj.dim <- t(napply(names, function(x) as.numeric(dim(x))[1:2]))
    vec <- is.na(obj.dim)[, 1] & (obj.type != "function")
    obj.dim[vec, 1] <- napply(names, length)[vec]
    out <- data.frame(obj.type, obj.size, obj.dim)
    names(out) <- c("Type", "Size", "Rows", "Columns")
    if (!missing(order.by)) 
        out <- out[order(out[[order.by]]), ]
    out
}


r-help-bounces at r-project.org napsal dne 24.09.2010 23:04:20:

> 
> What's the best object browser?
> 
> Dear all,
> 
> I have tried all the popular R IDE or editors like Eclipse, Komodo, JGR,
> Revolution...
> They all have fancy fucntions like auto completion, syntax highlight....
> BUT, I JUST WANT A OBJECT BROWSER!
> 
> The easiest way to view objects in R console is fix(), but you have no
> global view of all the objects in the workspace.
> Revolution has the best object browser so far, but this thing is way too
> big...
> Eclipse all has automatically object browser, but you can't only see the
> basic summary info. and it's really tricky to configure StatET.
> Jgr is very handy, when you double click the object name, you can view 
the
> object in a spreadsheet like using fix(), but you have to press the
> "Refresh" button each time you want to see the updated objects...
> 
> So, is there any thing like the combination of eclipse and Jgr?
> If not, I am interested to develope something to fulfill this simple but
> very important function. But right now I have no idea where to start. 
Any
> suggestions?
> 
> 
> Peter
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/Object-Browser-
> tp2594912p2594912.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list