-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projeto de IC #6
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
Package: dicionariosIBGE | ||
Type: Package | ||
Title: Dictionaries for reading survey microdata from IBGE | ||
Version: 1.1 | ||
Date: 2010-05-14 | ||
Author: Erick Fonseca <[email protected]>, Alexandre | ||
Rademaker<[email protected]> | ||
Maintainer: Erick Fonseca <[email protected]> | ||
Description: This package contains dictionaries for reading microdata | ||
Title: Dictionaries for reading microdata surveys from IBGE | ||
Version: 1.6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a versão deve mudar para 1.7, certo? Vcs fizeram mudanças, não pode continuar sendo 1.6 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Versão alterada. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. não vejo ainda... cuidado! Estou achando que vcs partiram de versão antiga do repositório... melhor conferir antes de corrigir os problemas. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A versão alterada está no repositório do nosso projeto, referente a nossa matéria. |
||
Date: 2014-08-13 | ||
Author: Alexandre Rademaker <[email protected]> | ||
Maintainer: Alexandre Rademaker <[email protected]> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. existe algum campo para contribuidor? Se sim, vcs poderiam colocar o nome de vocês. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Já foram alteradas a data e a versão. |
||
Description: This package contains the dictionaries for reading microdata | ||
from IBGE (Brazilian Institute of Geography and Statistics) | ||
surveys PNAD, PME and POF. | ||
License: GNU Public License | ||
Suggests: IBGEPesq | ||
LazyLoad: yes | ||
Packaged: 2010-05-14 20:42:13 UTC | ||
Built: R 2.10.0; ; 2010-07-01 18:22:00 UTC; unix | ||
License: GPL (>= 2) | ||
Depends: R (>= 2.15.1) | ||
Repository: CRAN | ||
URL: http://github.com/arademaker/dicionariosIBGE | ||
BugReports: http://github.com/arademaker/dicionariosIBGE/issues | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
This software is distributed under the terms of the GNU General Public | ||
License as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
|
||
As of writing, this essentially boils down to two possible licenses, | ||
GPL version 2 and version 3. Copies of these licenses are available | ||
in files GPL-2 and GPL-3 in the sources of this package, as well as at | ||
|
||
http://www.r-project.org/Licenses/ | ||
|
||
They can also be viewed from within R using | ||
|
||
RShowDoc("GPL-2") | ||
RShowDoc("GPL-3") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exportPattern("^[^\\.]") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O que esta linha significa? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Esta linha já estava no código antes da modificação. O que foi inserido foram os imports necessários para corrigir os erros presentes do NOTE, conforme explicitamos no issue no nosso repositório. De toda forma, esta linha refere-se à definição das variáveis, de forma que o pacote exporta tudo a partir do namespace que não começa com um ponto. |
||
importFrom("utils", "setTxtProgressBar", "txtProgressBar", | ||
"type.convert") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
?import | ||
??import | ||
??importFrom | ||
base::import("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
base::importFrom("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
base::ImportFrom("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
install.packeges("base") | ||
install.packages("base") | ||
install.packages("base") | ||
install.packages("base") | ||
install.packages("base") | ||
install.packages("base") | ||
install.packages("base") | ||
install.packages("base") | ||
library(base) | ||
ImportFrom("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
.ImportFrom("utils", | ||
"setTxtProgressBar", | ||
"txtProgressBar", | ||
"type.convert") | ||
.ImportFrom("utils") | ||
ImportFrom("utils") | ||
importFrom("utils") | ||
??setTxtProgressBar | ||
??utils | ||
filename <- tempfile() | ||
promptPackage("utils", filename = filename) | ||
file.show(filename) | ||
unlink(filename) | ||
filename <- tempfile() | ||
promptPackage("dicionariosIBGE", filename = filename) | ||
file.show(filename) | ||
unlink(filename) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
le.pesquisa <- function(dicionario, pathname.in, codigos, rotulos = NULL, tbloco = 2000, nlines = NA) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seria bom detalhar no PR o que foi modificado neste arquivo. Descrever de forma clara o que precisou ser mudado. Estou achando estranho TODAS as linhas terem sido modificadas. Foi isso mesmo? Ou talvez isto só tenha sido causado por vcs editarem este arquivo no Windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O código não foi modificado, aconteceu provavelmente por conta do Windows mesmo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nao foi isso. parece que foi mesmo erro de como @GabrielaKucuruza iniciou o repositório dela. Tem algo muito errado ... melhor falarmos urgente. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Qual erro? Eu estou no trabalho. Não sei a disponibilidade dos demais para uma reunião. |
||
|
||
inicios <- numeric(0) | ||
tamanhos <- numeric(0) | ||
|
||
#Condições da função: | ||
## Se é um NA, print "You must provide the number of lines of the data file" | ||
if(is.na(nlines)) | ||
stop(paste("You must provide the number of lines of the data file", substitute(dicionario), sep=" ")) | ||
|
||
## Se os valores forem falsos, print "The", substitute(dicionario)," is not a valid object for 'dicionario' parameter" | ||
if(!all(c("inicio","cod", "tamanho", "desc") == colnames(dicionario)) ) | ||
stop(paste("The", substitute(dicionario)," is not a valid object for 'dicionario' parameter",sep=" ")) | ||
|
||
## Se os valores forem falsos, print "The", substitute(dicionario)," is not a valid object for 'rotulos' parameter" | ||
if(!all(c("cod", "valor", "rotulo") == colnames(rotulos)) ) | ||
stop(paste("The", substitute(rotulos), "is not a valid object for 'rotulos' parameter", sep=" ")) | ||
|
||
tmp <- merge(data.frame(cod = codigos, stringsAsFactors = FALSE), dicionario) | ||
inicios <- tmp[ ,"inicio"] | ||
tamanhos <- tmp[ ,"tamanho"] | ||
rm(tmp) | ||
## Se o início do dado for == 0, print "Variables do not exist in", substitute(dicionario) | ||
if (length(inicios) == 0) | ||
stop(paste("Variables do not exist in", substitute(dicionario), sep=" ")) | ||
|
||
## Aqui é quando está lendo? "Will display a progress bar on the R console via text representation | ||
pb <- txtProgressBar(min = 0, max = (nlines/tbloco) * length(codigos), style = 3) | ||
arq <- file(pathname.in, open = "r") | ||
dados <- NULL | ||
|
||
process <- 0 | ||
cont <- TRUE | ||
while (cont) { | ||
bloco <- scan(file = arq, what = " ", sep = " ", nlines = tbloco, quiet = TRUE) | ||
df.temp <- NULL | ||
for (k in 1:length(inicios)) { | ||
coluna <- substr(bloco, inicios[k], inicios[k] + tamanhos[k] - 1) | ||
if(is.null(df.temp)) | ||
df.temp <- data.frame(type.convert(coluna)) | ||
else | ||
df.temp <- cbind(df.temp, data.frame(type.convert(coluna))) | ||
process <- process + 1 | ||
setTxtProgressBar(pb, process) | ||
} | ||
## Se os dados forem nulos | ||
if(is.null(dados)) | ||
dados <- df.temp | ||
else | ||
dados <- rbind(dados, df.temp) | ||
if (length(bloco) < tbloco) | ||
cont <- FALSE | ||
} | ||
close(arq) | ||
rm(bloco, df.temp) | ||
colnames(dados) <- codigos | ||
close(pb) | ||
if(is.null(rotulos)){ | ||
return(dados) | ||
} | ||
for(n in 1:ncol(dados)){ | ||
colname <- colnames(dados)[n] | ||
if(colname %in% rotulos$cod){ | ||
tmp <- rotulos[rotulos$cod == colname, 2:3] | ||
dados[,n] <- factor(dados[,n], levels = tmp[,1], labels = tmp[,2]) | ||
} | ||
} | ||
return(dados) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
\name{dic10pof2008.2009} | ||
\docType{data} | ||
|
||
\alias{dic10pof2008.2009} | ||
|
||
\encoding{UTF-8} | ||
\title{Dictionary for estimated rent record POF 2008-2009 survey} | ||
|
||
\description{ | ||
|
||
Data dictionary for reading "T_ALUGUEL_ESTIMADO_S.txt" file (estimated | ||
rent (type 10) record from POF 2008-2009 survey). | ||
|
||
} | ||
|
||
\format{ | ||
This dictionary is a data frame with one line for each variable, | ||
and it has 4 columms, with important information of each variable. | ||
|
||
\tabular{lll}{ | ||
inicio \tab numeric \tab Position of the value's first character in | ||
the data file \cr | ||
cod \tab character \tab Variable code \cr | ||
tamanho \tab numeric \tab Field size \cr | ||
desc \tab character \tab Short description\cr | ||
|
||
} | ||
} | ||
\source{The dictionaries were made based on the documentation of the | ||
PNAD survey available at \url{http://www.ibge.gov.br}.} | ||
\keyword{datasets} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
\name{dic11pof2008.2009} | ||
\docType{data} | ||
|
||
\alias{dic11pof2008.2009} | ||
|
||
\encoding{UTF-8} | ||
\title{Dictionary for book of outgoing record POF 2008-2009 survey} | ||
|
||
\description{ | ||
|
||
Data dictionary for reading "T_CADERNETA_DESPESA_S.txt" file (book of | ||
outgoing (type 11) record from POF 2008-2009 survey). | ||
|
||
The \code{COD_LOCAL_COMPRA} (site of acquisition) appers in the file | ||
'Descricoes dos registros POF 2008-2009.doc' (documentation provided | ||
by IBGE) as having the level \code{88801} associated to the label | ||
\code{ignorado}, but in the files 'Classificacoes POF 2008-2009.doc' and | ||
'Cadastro de local de aquisicoes da POF 2008-2009.xls' appears the | ||
same label associated to other level, \code{99902}. In the file | ||
'Descricoes dos registros POF 2008-2009.doc' the level ZERO is | ||
associated to the label \code{nao aplicavel}. | ||
|
||
|
||
} | ||
|
||
\format{ | ||
This dictionary is a data frame with one line for each variable, | ||
and it has 4 columms, with important information of each variable. | ||
|
||
\tabular{lll}{ | ||
inicio \tab numeric \tab Position of the value's first character in | ||
the data file \cr | ||
cod \tab character \tab Variable code \cr | ||
tamanho \tab numeric \tab Field size \cr | ||
desc \tab character \tab Short description\cr | ||
|
||
} | ||
} | ||
\source{The dictionaries were made based on the documentation of the | ||
PNAD survey available at \url{http://www.ibge.gov.br}.} | ||
\keyword{datasets} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
\name{dic12pof2008.2009} | ||
\docType{data} | ||
|
||
\alias{dic12pof2008.2009} | ||
|
||
\encoding{UTF-8} | ||
\title{Dictionary for individual outgoing record POF 2008-2009 survey} | ||
|
||
\description{ | ||
|
||
Data dictionary for reading "T_DESPESA_S.txt" file (individual | ||
outgoing (type 12) record from POF 2008-2009 survey). | ||
|
||
The \code{COD_LOCAL_COMPRA} (site of acquisition) appers in the file | ||
'Descricoes dos registros POF 2008-2009.doc' (documentation provided | ||
by IBGE) as having the level \code{88801} associated to the label | ||
\code{ignorado}, but in the files 'Classificacoes POF 2008-2009.doc' and | ||
'Cadastro de local de aquisicoes da POF 2008-2009.xls' appears the | ||
same label associated to other level, \code{99902}. In the file | ||
'Descricoes dos registros POF 2008-2009.doc' the level ZERO is | ||
associated to the label \code{nao aplicavel}. | ||
|
||
The variable \code{COD_CARACTERISTICA} (characteristic of the drugs) | ||
has the value ZERO, when reading the data file, but that value is not | ||
related to any category in any of the documentation files (provided by | ||
IBGE).Because of that appears NAs in the categorical variables when | ||
you read the data using the \code{rotulos} parameter of the | ||
\link{le.pesquisa} function. | ||
} | ||
|
||
\format{ | ||
This dictionary is a data frame with one line for each variable, | ||
and it has 4 columms, with important information of each variable. | ||
|
||
\tabular{lll}{ | ||
inicio \tab numeric \tab Position of the value's first character in | ||
the data file \cr | ||
cod \tab character \tab Variable code \cr | ||
tamanho \tab numeric \tab Field size \cr | ||
desc \tab character \tab Short description\cr | ||
|
||
} | ||
} | ||
\source{The dictionaries were made based on the documentation of the | ||
PNAD survey available at \url{http://www.ibge.gov.br}.} | ||
\keyword{datasets} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
\name{dic13pof2008.2009} | ||
\docType{data} | ||
|
||
\alias{dic13pof2008.2009} | ||
|
||
\encoding{UTF-8} | ||
\title{Dictionary for vehicle outgoing record POF 2008-2009 survey} | ||
|
||
\description{ | ||
|
||
Data dictionary for reading "T_DESPESA_VEICULO_S.txt" file (vehicle | ||
outgoing (type 13) record from POF 2008-2009 survey). | ||
|
||
The \code{COD_LOCAL_COMPRA} (site of acquisition) appers in the file | ||
'Descricoes dos registros POF 2008-2009.doc' (documentation provided | ||
by IBGE) as having the level \code{88801} associated to the label | ||
\code{ignorado}, but in the files 'Classificacoes POF 2008-2009.doc' and | ||
'Cadastro de local de aquisicoes da POF 2008-2009.xls' appears the | ||
same label associated to other level, \code{99902}. In the file | ||
'Descricoes dos registros POF 2008-2009.doc' the level ZERO is | ||
associated to the label \code{nao aplicavel}. | ||
|
||
} | ||
|
||
\format{ | ||
This dictionary is a data frame with one line for each variable, | ||
and it has 4 columms, with important information of each variable. | ||
|
||
\tabular{lll}{ | ||
inicio \tab numeric \tab Position of the value's first character in | ||
the data file \cr | ||
cod \tab character \tab Variable code \cr | ||
tamanho \tab numeric \tab Field size \cr | ||
desc \tab character \tab Short description\cr | ||
|
||
} | ||
} | ||
\source{The dictionaries were made based on the documentation of the | ||
PNAD survey available at \url{http://www.ibge.gov.br}.} | ||
\keyword{datasets} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
\name{dic14pof2008.2009} | ||
\docType{data} | ||
|
||
\alias{dic14pof2008.2009} | ||
|
||
\encoding{UTF-8} | ||
\title{Dictionary for income and deductions record POF 2008-2009 survey} | ||
|
||
\description{ | ||
|
||
Data dictionary for reading "T_RENDIMENTOS_S.txt" file (income and | ||
deductions (type 14) record from POF 2008-2009 survey). | ||
|
||
} | ||
|
||
\format{ | ||
This dictionary is a data frame with one line for each variable, | ||
and it has 4 columms, with important information of each variable. | ||
|
||
\tabular{lll}{ | ||
inicio \tab numeric \tab Position of the value's first character in | ||
the data file \cr | ||
cod \tab character \tab Variable code \cr | ||
tamanho \tab numeric \tab Field size \cr | ||
desc \tab character \tab Short description\cr | ||
|
||
} | ||
} | ||
\source{The dictionaries were made based on the documentation of the | ||
PNAD survey available at \url{http://www.ibge.gov.br}.} | ||
\keyword{datasets} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a versão no master do arademaker/dicionariosIBGE é 1.6. Como aqui está aparecendo a versão 1.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Essa foi a alteração feita hoje:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reforço que não estou conseguindo entender como este PR foi feito. Não vou conseguir avaliar o projeto de vocês.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boa tarde @arademaker lamento a demora, estava sem acesso a computador até o presente momento. Entendi agora que houve uma confusão na realização do PR e peço desculpas, me orientei erroneamente pela data da versão do erick, que aparecia de 8 anos atrás. Para evitar os conflitos, queria confirmar com o senhor se posso realizar um novo PR que esteja alinhado com a última versão do pacote. Fico no aguardo e agradeço desde já pela compreensão.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obs: como @tayaracausanilhas fez atualizações no repositório do emap-ic, para evitar os problemas que tive, fiz um fork do seu repositório e então adicionei todos o nosso projeto, na minha conta pessoal. Eu realizaria o PR a partir daqui, https://github.com/GabrielaKucuruza/dicionariosIBGE,