
Veja se isso te ajuda:
lista <- doBy::splitBy(formula = ~ V2, data = arq_1)
att, FH On 23 October 2015 at 13:31, Paulo Henrique Pimenta < paulopimenta6@hotmail.com> wrote:
Olá Listeiros,
Estou com um problema na criação de novas listas no R. Abaixo segue parte do meu código:
arq_1 <- read.table("C:/Users/Paulo/Documents/Alturas_Ilha_Fiscal-2015-10-22/Alturas_Ilha_Fiscal/50140002560102196123121961ALT_MOD.xls")
######################################################################################################## Fazendo a mao mes a mes ####################
jan <- arq_1[which(arq_1$V2==1),] fev <- arq_1[which(arq_1$V2==2),] mar <- arq_1[which(arq_1$V2==3),] abril <- arq_1[which(arq_1$V2==4),] maio <- arq_1[which(arq_1$V2==5),] junho <- arq_1[which(arq_1$V2==6),] julho <- arq_1[which(arq_1$V2==7),] agosto <- arq_1[which(arq_1$V2==8),] setembro <- arq_1[which(arq_1$V2==9),] outubro <- arq_1[which(arq_1$V2==10),] novembro <- arq_1[which(arq_1$V2==11),] dezembro <- arq_1[which(arq_1$V2==12),]
################automatizando#####################
for (i in 1:12){
mes[i] <- arq_1[which(arq_1$V2==i),]
}
Eu gostaria de poder automatizar o primeiro processo, a captação de um bloco da lista arq_1 para a variável mes[i], porém eu recebo a mensagem:
There were 12 warnings (use warnings() to see them)
e ao abrir os warnings:
Warning messages: 1: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 2: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 3: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 4: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 5: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 6: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 7: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 8: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 9: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 10: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 11: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length 12: In mes[i] <- arq_1[which(arq_1$V2 == i), ] : number of items to replace is not a multiple of replacement length
Fazendo pelo processo manual dá certo, mas pq fazendo pelo processo “automatizado" não é possível. Peço ajuda de vocês para encontrar uma saída!
Um grande abraço a todos
Paulo.
Sent from Windows Mail
_______________________________________________ R-br mailing list R-br@listas.c3sl.ufpr.br https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.