[R-br] reamostragem automatizada

Éder Comunello comunello.eder em gmail.com
Sexta Junho 6 17:41:40 BRT 2014


Samuel, boa tarde!

Segue uma sugestão,

### <code r>
dados <- data.frame(h=c(18.79, 12.34, 14.11, 15.24, 13.82, 14.54, 13.77,
13.99, 10.00, 16.80, 10.49, 20.00, 14.19, 14.09, 14.65, 12.22, 16.21,
13.90, 16.29, 15.39), parc=rep(1:4, each=5), arv=rep(1:5, 4))

{set.seed(765); sorteio  <- lapply(10:1, function(x)
unlist(sample(seq(dados[,1]),x)))}
sorteio
datasets <- lapply(sorteio, function(x) dados[unlist(x),]); datasets
medias   <- sapply(sorteio, function(x) c(colMeans(dados[unlist(x),]),
n=length(x))); medias
soma     <- sapply(sorteio, function(x) c(colSums(dados[unlist(x),]),
n=length(x))); soma
### </code>


Éder Comunello <c <comunello.eder em gmail.com>omunello.eder em gmail.com>
Dourados, MS - [22 16.5'S, 54 49'W]
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20140606/ebc857e5/attachment-0001.html>


Mais detalhes sobre a lista de discussão R-br