Many thanks to those who replied -- I am well and truly kick-started!
A) As already posted to the list, Sundar Dorai-Raj suggested:
1) `for':
# assume each vector is named `sample.i'
# where `i' is 1:N
samp <- c()
for(i in 1:N)
samp <- c(samp, get(paste("sample", i, sep = ".")))
I'd tried various schemes involving for(), but had forgotten get(), so I
think Sundar gets the mind-reading prize.
2) `do.call':
# assume your N samples are in a list `samp.list'
# where length(samp.list) == N
samp <- do.call("c", samp.list)
This also came from Brian Ripley.
B) Naomi Altman also pointed out a simple scheme, given a list of the
samples:
unlist(sample.list)
C) Jean Adams and Bert Gunter both suggested using collapse(), given N
eval(parse(text=paste('c(',paste('sample',1:N,sep='.',collapse=','),')',sep=
'')))
D) Winnie Lambert reminded me that append() would also do the trick.
Julian Wells
School of Management
The Open University
Walton Hall
Milton Keynes
MK7 6AA
United Kingdom
(01908) 654658
+44 (1908) 654658
|