Last active
December 17, 2015 00:10
-
-
Save metodologia/5518675 to your computer and use it in GitHub Desktop.
Microdados com R - Parte 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ---------------------------------------------- | |
| # Primeiros passos com o SQLite | |
| # carregar pacote RSQLite | |
| library('RSQLite') | |
| # criar uma base de dados | |
| sqldf("attach pnad as new") | |
| # estabelecer uma conexão | |
| drv<-dbDriver("SQLite") | |
| con<-dbConnect(drv, dbname='pnad') | |
| # transformar um csv em uma base SQLite | |
| # PNAD 2011 domicílios | |
| a <- read.csv2.sql(file="2011_PES.csv", sql="create table pes2011 as select * from file", header=TRUE, row.names=FALSE, sep=';' , dbname="pnad") | |
| dbGetQuery(con, "select * from pes2011 limit 20") | |
| # demais funções para serem estudadas para obter bom desempenho com base de dados SQL | |
| # dbListTables() | |
| # dbRemoveTable() | |
| # dbWriteTable() | |
| # dbGetQuery() | |
| # ---------------------------------------------- | |
| {{código do R - Fim}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment