[R-br] Help please
Danielle Steffen
daniellesteffen em yahoo.com
Quinta Julho 5 03:54:32 BRT 2012
Ola,
Estou batendo cabeca com o R. Estou com um dos arquivos txt da amostra do censo 2010, e apesar de saber importar com mascara de leitura em SPSS e SAS, estou me sentindo um pre-escolar no R. como faco importacao com mascara de leitura? sabe, aquela coisa de colocar
caracter 1 a 4 - var 1
caracter 5 a 7 - var 2
e assim por diante.
Bati cabeca com a funcao scan, mas como ela nao me ama e sao quase 3h da manha por aqui, ela nao quis importar, a sintaxe foi ridicula, tentei enfiar a mascara numa lista dentro do what, com os comprimentos de cada campo do arquivo:
teste <- scan("C:/Users/Public/novo case/amostra.txt", what=list(
length(2),length(5),length(13),length(8),length(3),length(1),length(2),length(3),length(2),length(1),length(2),length(2),length(1),length(3),length(3),length(2),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(4),length(1),length(7),length(7),length(3),length(3),length(1),length(7),length(7),length(7),length(1),length(7),length(7),length(7),length(1),length(1),length(2),length(2),length(1),length(1),length(2),length(1),length(1),length(1),length(3),length(3),length(3),length(1),length(7),length(7),length(7),length(1),length(2),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(4),length(5),length(1),length(1),length(1),length(1),length(6),length(6),length(4),length(1),length(6),length(4),length(7),length(4),length(7),length(4),length(7),length(5),length(6),length(4),length(3),length(1),length(1),length(1),length(1),length(1),length(1),length(6),length(1),length(7),length
(7),length(7),length(1),length(1),length(1),length(2),length(2),length(2),length(1),length(2),length(2),length(2),length(1),length(3),length(1),length(1),length(1),length(2),length(4),length(1),length(2),length(2),length(2),length(2),length(1),length(2),length(1),length(1),length(1),length(1),length(1),length(3),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),len
gth(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1),length(1)
))
Mas esta obviamente errado e claro, nao sei pq.
Alguem me ajuda? Nao precisa ser essa funcao, mas tentei achar uma que fosse a mais flexivel possivel, pq as outras que uso (read.table, read.csv, etc) elas supoe que o arquivo tem algum tipo de separador, nem que seja um espacinho qualquer pra quebrar o galho.
Agradeco qq ajuda, e nao me zoem, estou morrendo de sono e odio do R.
Abs,
Danielle
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20120704/5e8c4cd9/attachment.html>
Mais detalhes sobre a lista de discussão R-br