
Outra solução seria o uso da função split. lista <- split(arp_1, arq_1$V2) Att. Luciano Em 23/10/2015 19:46, "FHRB Toledo" <fernandohtoledo@gmail.com> escreveu:
Nesse caso,
Uma "automatização" bem naif seria:
lista <- lapply(1:12, function(mes) subset(arq_1, V2 == mes))
P.S.: Considere solicitar ao administrador da sua máquina atualizar sua versão, bem como instalar pacotes úteis!
att, FH
On 23 October 2015 at 16:19, Paulo Henrique Pimenta < paulopimenta6@hotmail.com> wrote:
Olá FHRB,
A solução lista <- doBy::splitBy(formula = ~ V2, data = arq_1) parece interessante, no entanto o computador que eu uso não possui para mim acesso para realizar atualizações, assim o pacote doBy não pode ser usado, ele não esta disponível para a versão 2.14.1 do R
Abraços.
Paulo Henrique de A. S. Pimenta.
Graduando em Meteorologia (Bacharelado) - IAG/USP. Fone: +5511981318435.
------------------------------ From: paulopimenta6@hotmail.com To: r-br@listas.c3sl.ufpr.br Subject: Problemas com criação de listas Date: Fri, 23 Oct 2015 18:31:56 +0000
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.
_______________________________________________ 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.