Hi:
I'm sure this seems like a rudimentary question, but I am not well versed
with R syntax for lists. I have a ragged array from which I've removed
records (entire rows) with missing data. The functions I used to remove the
missing cases resulted in the generation of an R list class object,
??
Something like:
lapply(mydata, function(x){
nr - nrow(x)
x[sample(seq_len(nr),nr,rep=TRUE),]
})
maybe. The idea is to use the sampled rows as your row index.
-- Bert
On Mon, Apr 2, 2012 at 11:24 AM, Bcampbell99 briand.campb...@ec.gc.ca wrote:
Hi:
I'm sure this seems like a rudimentary
## recreating your data
mydata-list(matrix(1:9, nrow=3, byrow=T),
matrix(10:15, nrow=2, byrow=T),
matrix(16:30, nrow=5, byrow=T))
## get the shortest matrix in your list
n - min(unlist(lapply(mydata, nrow)))
## subset the list into random samples of length n
3 matches
Mail list logo