From ripley at stats.ox.ac.uk  Wed May  9 16:44:16 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 9 May 2007 15:44:16 +0100 (BST)
Subject: [Rd] fix() changes the class of mts objects
In-Reply-To: <3c12769c0705090742n53e8b641ma68bbe4267a60dad@mail.gmail.com>
References: <3c12769c0705090615y3be14091w37bf6cc06bb01b0c@mail.gmail.com> 
	<Pine.LNX.4.64.0705091457250.6403@auk.stats>
	<3c12769c0705090742n53e8b641ma68bbe4267a60dad@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0705091543360.9689@gannet.stats.ox.ac.uk>

On Wed, 9 May 2007, Simone Giannerini wrote:

> My concern here is that users can be confused from the fact that if one has
> a single time series fix() uses the default method of edit() and does not
> change
> its class
>
>> x <- ts(1:5)
>> fix(x)
>> class(x)
> [1] "ts"
>
> whereas for mts objects edit.data.frame is used so that in my opinion it
> might be worth to clarify it in the documentation.

Which documentation do you suggest?  That vectors and matrices are treated 
differently is there.

>
> Regards
>
> Simone
>
> On 5/9/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>> 
>> Why did you expect otherwise?: fix() is treating it as matrix and
>> ?edit.matrix says that it only works on 'simple data frames' (and converts
>> matrices to such).
>> 
>> Editing R objects can easily change aspects of them, as dput() is not
>> faithful, environments can get lost and so on.
>> 
>> On Wed, 9 May 2007, Simone Giannerini wrote:
>> 
>> > Dear all,
>> >
>> > it looks like fix() changes the class of mts objects, here is a
>> reproducible
>> > example (tested both on WinXP and Linux):
>> >
>> >> x <- ts(cbind(1:5,1:5))
>> >> x
>> > Time Series:
>> > Start = 1
>> > End = 5
>> > Frequency = 1
>> >  Series 1 Series 2
>> > 1        1        1
>> > 2        2        2
>> > 3        3        3
>> > 4        4        4
>> > 5        5        5
>> >> class(x)
>> > [1] "mts" "ts"
>> >> edit(x)
>> >     Series 1 Series 2
>> > [1,]        1        1
>> > [2,]        2        2
>> > [3,]        3        3
>> > [4,]        4        4
>> > [5,]        5        5
>> >> class(x)
>> > [1] "mts" "ts"
>> >> fix(x)
>> >> class(x)
>> > [1] "matrix"
>> >> x
>> >     Series 1 Series 2
>> > [1,]        1        1
>> > [2,]        2        2
>> > [3,]        3        3
>> > [4,]        4        4
>> > [5,]        5        5
>> >
>> >> R.version
>> >               _
>> > platform       i386-pc-mingw32
>> > arch           i386
>> > os             mingw32
>> > system         i386, mingw32
>> > status
>> > major          2
>> > minor          5.0
>> > year           2007
>> > month          04
>> > day            23
>> > svn rev        41293
>> > language       R
>> > version.string R version 2.5.0 (2007-04-23)
>> >
>> >> R.version
>> > platform       x86_64-unknown-linux-gnu
>> > arch           x86_64
>> > os             linux-gnu
>> > system         x86_64, linux-gnu
>> > status
>> > major          2
>> > minor          5.0
>> > year           2007
>> > month          04
>> > day            23
>> > svn rev        41293
>> > language       R
>> > version.string R version 2.5.0 (2007-04-23)
>> >
>> > ______________________________________________________
>> >
>> > Simone Giannerini
>> > Dipartimento di Scienze Statistiche "Paolo Fortunati"
>> > Universita' di Bologna
>> > Via delle belle arti 41 - 40126  Bologna,  ITALY
>> > Tel: +39 051 2098262  Fax: +39 051 232153
>> > ______________________________________________________
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-devel at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>> >
>> 
>> --
>> Brian D. Ripley,                  ripley at stats.ox.ac.uk
>> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford,             Tel:  +44 1865 272861 (self)
>> 1 South Parks Road,                     +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>> 
>
>
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] fix() changes the class of mts objects
Prof Brian Ripley