Skip to content
Back to formatted view

Raw Message

Message-ID: <971536df0712162008m1815b799pfb93bf71907b9489@mail.gmail.com>
Date: 2007-12-17T04:08:35Z
From: Gabor Grothendieck
Subject: more structure than 'str'?
In-Reply-To: <4765E2A5.4010809@pdf.com>

On Dec 16, 2007 9:44 PM, Spencer Graves <spencer.graves at pdf.com> wrote:
>      How can I see more of the structure than displayed by 'str'?
> Consider the following:
>
>
> tstDF <- data.frame(a=1, row.names='b')
>  > str(tstDF)
> 'data.frame':   1 obs. of  1 variable:
>  $ a: num 1
>
>
>      The object 'tstDF' has row.names, but I have to suspect they are
> there -- AND know a function like 'row.names' or 'dimnames' -- to see
> them.
>
>      I've found 'str' extremely valuable for understanding and
> explaining to others the internal structure of an R object.   In many
> cases, it has helped me find fairly simple ways to do things with R
> objects that might have been much more difficult and perhaps infeasible
> without 'str' -- and without access to the right expert, who may not be
> available in the time I have to solve a particular problem.
>
>      Thanks again to Martin Maechler, who wrote 'str', and to everyone
> else who has replied to questions from me over the years.
>
>      Best Wishes,
>      Spencer Graves


Try this:

> dput(tstDF)
structure(list(a = 1), .Names = "a", row.names = "b", class = "data.frame")