Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed May 11, 2024
1 parent c85e775 commit 6c1dad3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
5 changes: 3 additions & 2 deletions tests/tests_rafa/geometry.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ geometry <- function(df,
year = parent.frame()$year,
showProgress = parent.frame()$showProgress){

# df <- censobr::read_tracts(year = 2022, dataset = 'PessoaRenda')
# df <- dplyr::collect(df)
# df <- censobr::read_tracts(year = 2010, dataset = 'PessoaRenda')
# df <- censobr::read_tracts(year = 2022, dataset = 'Preliminares')
# df <- dplyr::collect(df)

# download tracts geometry from geobr
tracts_sf <- geobr::read_census_tract(code_tract = 'all',
Expand Down
38 changes: 19 additions & 19 deletions tests/tests_rafa/survey.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ library(tictoc)

df <- read_population(year = 2010) |> filter(name_region == "Norte")

df2 <- as.data.frame(df)


srs_design_srvyr <- df2 %>% as_survey_design(ids = 1, fpc = V0010)

srs_design_survey <- svydesign(ids = ~1, fpc = ~fpc, data = apisrs)

df2 <- dplyr::collect(df)
names(df2)

# srs_design_srvyr <- df2 %>% as_survey_design(ids = 1, weights = V0010)
#
# srs_design_survey <- svydesign(ids = ~1, fpc = ~fpc, data = apisrs)
#
#

tic()
censo_designD <-
Expand All @@ -34,18 +34,18 @@ censo_designD <-
)
toc()

tic()
censo_designP <-
survey::svrepdesign(
weight = ~ V0010 ,
repweights = ~ V0010 ,
# type = "bootstrap",
combined.weights = FALSE ,
# scale = censo_wgts$scale ,
# rscales = v0010 ,
data = df
)
toc()
# tic()
# censo_designP <-
# survey::svrepdesign(
# weight = ~ V0010 ,
# repweights = ~ V0010 ,
# # type = "bootstrap",
# combined.weights = FALSE ,
# # scale = censo_wgts$scale ,
# # rscales = v0010 ,
# data = df
# )
# toc()


arrow::write_parquet(df, 'pop.parquet')
Expand Down
1 change: 1 addition & 0 deletions tests/tests_rafa/test_rafa.R
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ urlchecker::url_update()




# CMD Check --------------------------------
# Check package errors

Expand Down

0 comments on commit 6c1dad3

Please sign in to comment.