adrian_d at eskimo.com
2007-Nov-30 20:55 UTC
[Rd] dataframe does not expand as.Dates objects (PR#10481)
Full_Name: Adrian Dragulescu Version: 2.6.0 OS: Windows Submission from: (NULL) (216.99.178.65)> data.frame(x=1:10, y="A") # expands finex y 1 1 A 2 2 A 3 3 A 4 4 A 5 5 A 6 6 A 7 7 A 8 8 A 9 9 A 10 10 A> > data.frame(x=1:10, z=as.Date("2007-01-01")) # get an errorError in data.frame(x = 1:10, z = as.Date("2007-01-01")) : arguments imply differing number of rows: 10, 1>I always have to write a "rep" for date objects. It is not the end of the world but it would be nice if dates would behave like characters or numbers. Thank you.
ripley at stats.ox.ac.uk
2007-Dec-01 13:45 UTC
[Rd] dataframe does not expand as.Dates objects (PR#10481)
>From the help for data.frame() (sic):Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if necessary. so this is the documented behaviour. Perhaps you meant this for the wishlist, but you did not follow the instructions in the FAQ for sending it there. Nor is there any case made for why this would be desirable (and second-guessing the user's intentions often is not). I'll place it on the wishlist, but personally think it would be undesirable to add such an inconsistency to the language. On Fri, 30 Nov 2007, adrian_d at eskimo.com wrote:> Full_Name: Adrian Dragulescu > Version: 2.6.0 > OS: Windows > Submission from: (NULL) (216.99.178.65) > > >> data.frame(x=1:10, y="A") # expands fine > x y > 1 1 A > 2 2 A > 3 3 A > 4 4 A > 5 5 A > 6 6 A > 7 7 A > 8 8 A > 9 9 A > 10 10 A >> >> data.frame(x=1:10, z=as.Date("2007-01-01")) # get an error > Error in data.frame(x = 1:10, z = as.Date("2007-01-01")) : > arguments imply differing number of rows: 10, 1 >> > > I always have to write a "rep" for date objects. It is not the end of the world > but it would be nice if dates would behave like characters or numbers. > > Thank you. > > ______________________________________________ > 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