[R] `its' questions

Dirk Eddelbuettel edd at debian.org
Fri Aug 27 13:51:58 CEST 2004


On Fri, Aug 27, 2004 at 04:08:40PM +0530, Ajay Shah wrote:
> Problem 1: Often, when I'm dealing with its, str() breaks. Here's a
> bug demo. The first statements work fine --
[...]
> Problem 2: I try to write an its out and read it back in, but the two
> don't seem to be conformable for matrix subtraction.
[...]

Those two seem like genuine its bugs to me.

> Problem 3: How would I convert an its object into an ordinary
>   numerical matrix or data frame? I have succeeded with statements

Use    itsAsDf <- core(itsObject)   to turn 'itsObject' into a data.frame,
as.matrix and friends take it from there.

> Problem 4: I tried to do plot() and then lines() but that does not
>   seem to work. How does one superpose multiple curves on one picture,
>   where each of them is an its object?

The par(new=TRUE) command allows you do that generically. I.e. to add a second
object to a plot, and have it use the right axis, this works

   plot(Data)	      	      	  # plot something, sets up plot, axes, ...
   par(new=TRUE)		  # tell R we need more
   plot(moreData, axes=FALSE)	  # plot more, don't overplot x axis
   axis(4)	  		  # add 2nd y-axis on right


Hth, Dirk

-- 
Those are my principles, and if you don't like them... well, I have others.
                                                -- Groucho Marx




More information about the R-help mailing list