Christian Gold
2007-Dec-07 22:53 UTC
[R] How to prevent fix() from converting Dates into numeric
Dear list members Here is a strange problem that I have had for a long time, without finding out how to solve it. Whenever I use fix() on a data.frame that contains Dates, these are converted to numerics. As shown by the very simple example: a <- data.frame(var1 = 1, today = Sys.Date() ) a fix(a) a Why is that? And can anything be done against it? Many thanks for your help! Best, Christian Gold www.uib.no/people/cgo022
Christian Gold
2007-Dec-07 22:58 UTC
[R] How to prevent fix() from converting Dates into numeric
Dear list members Here is a strange problem that I have had for a long time, without finding out how to solve it. Whenever I use fix() on a data.frame that contains Dates, these are converted to numerics. As shown by the very simple example: a <- data.frame(var1 = 1, today = Sys.Date() ) a fix(a) a Why is that? And can anything be done against it? Many thanks for your help! Best, Christian Gold www.uib.no/people/cgo022
Prof Brian Ripley
2007-Dec-08 07:37 UTC
[R] How to prevent fix() from converting Dates into numeric
fix on a data frame calls edit: see ?edit.data.frame. The help for fix does say Editing an \R object may change it in ways other than are obvious: see the comment under \code{\link{edit}}. The simple answer is not to use fix() or edit() on other than the data frames they are documented to work on. On Fri, 7 Dec 2007, Christian Gold wrote:> Dear list members > > Here is a strange problem that I have had for a long time, without > finding out how to solve it. Whenever I use fix() on a data.frame that > contains Dates, these are converted to numerics. As shown by the very > simple example: > > a <- data.frame(var1 = 1, today = Sys.Date() ) > a > fix(a) > a > > Why is that? And can anything be done against it? > > Many thanks for your help! > > Best, > > Christian Gold > www.uib.no/people/cgo022 > > ______________________________________________ > 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. >-- 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
Christian Gold
2007-Dec-08 10:33 UTC
[R] How to prevent fix() from converting Dates into numeric
Thanks. So there is no solution, other than avoiding fix() and edit()? What would then be the recommended way to make visible and inspect large data.frames (i.e. that are to big for sensibly displaying on the console)? Would I need to write the data to a file and open in a spreadsheet programme? Christian Prof Brian Ripley wrote:> fix on a data frame calls edit: see ?edit.data.frame. The help for fix > does say > > Editing an \R object may change it in ways other than are obvious: see > the comment under \code{\link{edit}}. > > The simple answer is not to use fix() or edit() on other than the data > frames they are documented to work on. > > On Fri, 7 Dec 2007, Christian Gold wrote: > >> Dear list members >> >> Here is a strange problem that I have had for a long time, without >> finding out how to solve it. Whenever I use fix() on a data.frame that >> contains Dates, these are converted to numerics. As shown by the very >> simple example: >> >> a <- data.frame(var1 = 1, today = Sys.Date() ) >> a >> fix(a) >> a >> >> Why is that? And can anything be done against it? >> >> Many thanks for your help! >> >> Best, >> >> Christian Gold >> www.uib.no/people/cgo022 >> >> ______________________________________________ >> 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. >> >
Prof Brian Ripley
2007-Dec-08 15:12 UTC
[R] Viewing a large data frame (was How to prevent fix() from converting Dates into numeric)
See ?View for your new question (and please change the subject line when you change the subject: see the R posting guide) You could also have used e.g. format() on the data frame before calling fix() if all you want to do was to view it. On Sat, 8 Dec 2007, Christian Gold wrote:> Thanks. So there is no solution, other than avoiding fix() and edit()? > What would then be the recommended way to make visible and inspect large > data.frames (i.e. that are to big for sensibly displaying on the console)? > Would I need to write the data to a file and open in a spreadsheet programme? > > Christian > > > > Prof Brian Ripley wrote: >> fix on a data frame calls edit: see ?edit.data.frame. The help for fix >> does say >> >> Editing an \R object may change it in ways other than are obvious: see >> the comment under \code{\link{edit}}. >> >> The simple answer is not to use fix() or edit() on other than the data >> frames they are documented to work on. >> >> On Fri, 7 Dec 2007, Christian Gold wrote: >> >>> Dear list members >>> >>> Here is a strange problem that I have had for a long time, without >>> finding out how to solve it. Whenever I use fix() on a data.frame that >>> contains Dates, these are converted to numerics. As shown by the very >>> simple example: >>> >>> a <- data.frame(var1 = 1, today = Sys.Date() ) >>> a >>> fix(a) >>> a >>> >>> Why is that? And can anything be done against it? >>> >>> Many thanks for your help! >>> >>> Best, >>> >>> Christian Gold >>> www.uib.no/people/cgo022 >>> >>> ______________________________________________ >>> 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. >>> >> >-- 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