On Fri, Dec 18, 2009 at 2:39 PM, William Dunlap <wdun...@tibco.com> wrote:

> >       colchoose( data.frame(a=1:4,b=11:14), c('a','b','b','a'))
> >            => c(1,11,11,1)
>
> I thought you would want c(1,12,13,4), not c(1,11,11,1),
> out of this call.  Perhaps I misunderstand your requirements.
>

Sorry, you're right.  I edited my test case and didn't change the results --
my apologies!


> However, if you want c(1,12,13,4) one approach is to use
> a 2-column matrix of integers as the subscript into the
> main matrix (or data.frame).


Thanks!  That makes sense.  This looks like a good way of doing things.

            -s

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to