Skip to content
Prev 257369 / 398506 Next

rownames in an apply function

On Tue, Apr 19, 2011 at 6:59 AM, santosh <santosh.srinivas at gmail.com> wrote:
Try this:

sapply(time(tmp), function(tt) rownames(tmp[tt]))

# however, it may be that what you really want is
# the times and not the rownames:

lapply(time(tmp), function(tt) tt)

# also note that indexing by time works

sapply(time(tmp), function(tt) tmp[tt])