Re: [Rd] apply() returning a list?

From: David A. Johnston <dajohnston_at_ucdavis.edu>
Date: Wed, 20 Jul 2011 11:14:10 -0700 (PDT)

I understand that the coercion to a list is somewhat trivial. The coercion is a little less obvious when apply()'s output is a matrix. For example,

> x = matrix(1:12, 3, 4)
> apply(x, 1, range)

     [,1] [,2] [,3]
[1,] 1 2 3
[2,] 10 11 12

> structure(as.list(as.data.frame(apply(x, 1, range))), names = NULL)
[[1]]
[1] 1 10

[[2]]
[1] 2 11

[[3]]
[1] 3 12

Still relatively easy, but I do think it would be logical and intuitive if apply() had the same types of arguments as the other similar *apply functions.

-David Johnston

--
View this message in context: http://r.789695.n4.nabble.com/apply-returning-a-list-tp3679619p3681695.html
Sent from the R devel mailing list archive at Nabble.com.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 21 Jul 2011 - 08:50:28 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jul 2011 - 09:50:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive