[R] Finding the format of an object redux

Thomas L Jones DrJones at alum.MIT.edu
Fri Apr 14 04:23:41 CEST 2006

Okay, I am dealing with an object. Without going into too much detail, 
a gam (Generalized Additive Model) is involved. Assume that the name 
of the object is "obj" without the quotes. I tell it:

print (obj) inside a function.

I get out a bunch of pairs of lines.

(1) Odd-numbered lines are integers.
(2) Even-numbered lines have real/floating point numbers.

For example, the first two lines are:

       1        2        3        4        5        6        7 
5.354175 5.328358 5.293970 5.264434 5.235172 5.206112 5.177180 


The last two integers are 117 and 118; the corresponding real numbers 
are 4.354862 and 4.196938.

Jeepers, creepers, what does all this -MEAN?- Are the integers part of 
the object, or are they indices or subscripts or names or something?

The value of class (obj) is "numeric" including the quotes.
The value of is.numeric (obj) is TRUE.
The value of length (obj) is 118.

Well, is this a data frame or a matrix or a table or a vector whose 
elements are vectors of length two? Or a vector with two elements, 
each of which is a vector of length 118? Surely there is a way of 
finding out the answer to this question. Every time I look at the 
documentation, it just tells me to look somewhere else. Is there a 
function f such that f (obj) will tell you a little bit about the 
format of the object?

Thomas L. Jones, Ph.D., Computer Science

More information about the R-help mailing list