[R-br] Problemas com criação de listas

Paulo Henrique Pimenta paulopimenta6 em hotmail.com
Sexta Outubro 23 16:31:56 BRST 2015


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
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20151023/b68d4786/attachment.html>


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