#temp <- list() # troque por
temp <- vector(mode="list", lenght=20)
#for(i in 1:20){ # troque por
D <- data.frame(matrix(ncol=3,nrow=100))
colnames(D) <- c('ID','Tipo','Valor')
for(i in 1:length(temp)){
# temp[[i]] <- data.frame(matrix(ncol=3,nrow=100)) # pode ser criada fora do laço, D
# colnames(temp[[i]]) <- c('ID','Tipo','Valor')
temp[[i]] <- D
temp[[i]]$ID <- paste(i,sprintf("%03d",1:100),sep='')
temp[[i]]$Tipo <- factor(sample(0:10,100,replace=T),levels=c(0:10))
temp[[i]]$Valor <- rnorm(100,100,20)
}
dado <- data.frame(matrix(ncol=13,nrow=20))
colnames(dado) <- c('ID',paste('Tipo',sprintf('%02d',0:10),sep=''),'TipoNA')
for(i in 1:20){
dado[i,] <- c(i,table(temp[[i]]$Tipo,exclude=NULL))
}