[R] concat

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Apr 17 23:18:12 CEST 2002


jimi adams wrote:
> 
> i have a function that returns a list containing a variety of variable types
> i am trying to run the function multiple times and return the output into a
> variable with a semi-consistent naming pattern
> 
> i.e., for ten trials i want to return the list into variables
> trial1,trial2,...trial10
>
> is there a generic way to get this to happen
> 
> i have a similar process that does the same thing to an external file:
> 
>    paste("connection", trial, ".net", sep="") -> outfile
>    write(header, file=outfile, ncolumns=2)
>    write("*Edges", file=outfile, append=TRUE)
>    write(connection, file=outfile, ncolumns=2, append=TRUE)
> 
> where trial progresses so that these outputs are written to
> connection1.net, coneection2.net and so forth
> 
> i am having a tough time figuring out how to do the same for a variable
> within R
> 
> thanks
> and sorry, i just couldn't figure out the right place to look for this one.


  assign(paste("trial", i, sep=""), anything.to.be.assigned)

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list