Eric Elguero wrote:

> is there a way to pass a vector to a function
> expecting separate arguments?

        In general you can probably do something using

                do.call(FUN,as.list(v))

        where ``v'' is your vector.

> more specifically, I have a character vector, say u
> and I want a single string, but
> >paste(u) 
> doesn't work

        Yes it does if you do it right.  Read the help
        on paste().  (Hint:  There's an argument ``collapse''.)

>               so I would like something like 
> >paste(unvector(u)).
> 
> I am interested in a solution to the general problem too,
> as the only one I found is maintaining two versions of the
> functions I write.

        > v <- 1:3
        > do.call("paste",as.list(v))
        [1] "1 2 3"

        works, but this amounts to playing an unnecessary
        game of ring-around-the-rosy.

                                cheers,

                                        Rolf Turner
                                        [EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to