Heather.Turner@warwick.ac.uk
2005-Jul-13 11:26 UTC
[Rd] as.data.frame.table responseName argument (PR#8006)
Full_Name: Heather Turner Version: 2.1.1 OS: Windows XP Submission from: (NULL) (137.205.240.44) I get an error when trying to use the responseName argument of as.data.frame.table, e.g.> ## Create table > f <- gl(3, 3) > tab <- table(f) > tabf 1 2 3 3 3 3> ## Convert to data.frame - works fine > dat1 <- as.data.frame(tab) > dat1f Freq 1 1 3 2 2 3 3 3 3> ## As above with responseName - get error > dat2 <- as.data.frame(tab, responseName = "count")Error in as.data.frame(tab, responseName = "count") : unused argument(s) (responseName ...) I have checked the arguments of as.data.frame.table and responseName is there:> args(as.data.frame.table)function (x, row.names = NULL, optional = FALSE, responseName = "Freq", ...) NULL but I notice as.data.frame has no dots argument> args(as.data.frame)function (x, row.names = NULL, optional = FALSE) NULL which would (I think) explain the error, Heather
ripley@stats.ox.ac.uk
2005-Jul-13 11:49 UTC
[Rd] as.data.frame.table responseName argument (PR#8006)
You need to call as.data.frame.table directly here. If we alter the generic we would need to alter all the many methods too (including those in various CRAN packages), and I am not sure this would be worth it (rather than clarifying the documentation). This was a user-contributed enhancement that seems to have caused more problem that its value. On Wed, 13 Jul 2005 Heather.Turner at warwick.ac.uk wrote:> Full_Name: Heather Turner > Version: 2.1.1 > OS: Windows XP > Submission from: (NULL) (137.205.240.44) > > > I get an error when trying to use the responseName argument of > as.data.frame.table, e.g. > >> ## Create table >> f <- gl(3, 3) >> tab <- table(f) >> tab > f > 1 2 3 > 3 3 3 >> ## Convert to data.frame - works fine >> dat1 <- as.data.frame(tab) >> dat1 > f Freq > 1 1 3 > 2 2 3 > 3 3 3 >> ## As above with responseName - get error >> dat2 <- as.data.frame(tab, responseName = "count") > Error in as.data.frame(tab, responseName = "count") : > unused argument(s) (responseName ...) > > I have checked the arguments of as.data.frame.table and responseName is there: >> args(as.data.frame.table) > function (x, row.names = NULL, optional = FALSE, responseName = "Freq", > ...) > NULL > but I notice as.data.frame has no dots argument >> args(as.data.frame) > function (x, row.names = NULL, optional = FALSE) > NULL > which would (I think) explain the error, > > Heather > > ______________________________________________ > 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