[R] "unvector" ?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Sep 11 21:26:21 CEST 2006


"Eric Elguero" <Eric.Elguero at mpl.ird.fr> writes:

> Hi ev'rybody,
> 
> is there a way to pass a vector to a function
> expecting separate arguments?
> more specifically, I have a character vector, say u
> and I want a single string, but
> >paste(u) 
> doesn't work, 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.

In general, something like do.call("foo", as.list(args)), for paste()
in particulare, notice e.g. collapse=" ".


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list