[6558] in s-news-athena
Re: replicating rows
daemon@ATHENA.MIT.EDU (Douglas Bates)
Fri Mar 3 10:16:56 1995
Date: Fri, 3 Mar 95 08:32:53 -0600
From: bates@stat.wisc.edu (Douglas Bates)
To: key@wiggler.Princeton.EDU
Cc: s-news@utstat.toronto.edu
In-Reply-To: <9503031345.AA01236@wiggler.Princeton.EDU> (key@wiggler.Princeton.EDU)
>>>>> Robert M Key <key@wiggler.Princeton.EDU> writes:
> In this case I want to repeat the station, latitude and longitude
> "nosamp" times for each row of "stafile" then bind the resulting
> sum(nosamp(i)) X 3 matrix with dimnames to "datfile" which also has
> sum(nosamp(i)) rows to make "inmat".
I think you could use
nosamp <- stafile[rep(1:nrow(stafile), stafile[, "nosamp"]),
c("sta","lat","lon")]