Skip to content

Commit

Permalink
version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
choerulafifanto authored and cran-robot committed Dec 15, 2023
1 parent 4de63e9 commit 6fde9e2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
18 changes: 10 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
Package: samplingin
Title: Dynamic Survey Sampling Solutions
Version: 1.0.1
Version: 1.0.3
Authors@R:
person("Choerul", "Afifanto", email = "choerulafifanto@gmail.com", role = c("aut", "cre", "cph"))
Description: A robust solution employing both systematic and PPS (Probability Proportional to Size) sampling methods, ensuring a methodical and representative selection of data.
Seamlessly allocate predetermined allocations to smaller levels. Kish, L. (1965) <https://books.google.co.id/books?id=xiZmAAAAIAAJ>.
person("Choerul", "Afifanto", , "choerulafifanto@gmail.com", role = c("aut", "cre", "cph"))
Description: A robust solution employing both systematic and PPS
(Probability Proportional to Size) sampling methods, ensuring a
methodical and representative selection of data. Seamlessly allocate
predetermined allocations to smaller levels. Kish, L. (1965)
<https://books.google.co.id/books?id=xiZmAAAAIAAJ>.
License: MIT + file LICENSE
Depends: R (>= 2.10)
Imports: data.table, dplyr, DT, magrittr, rio, rlang, stats, stringr,
tidyr, utils
Imports: data.table, dplyr, magrittr, rlang, stats, utils
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.1
NeedsCompilation: no
Packaged: 2023-12-01 23:10:06 UTC; User
Packaged: 2023-12-14 04:40:05 UTC; User
Author: Choerul Afifanto [aut, cre, cph]
Maintainer: Choerul Afifanto <choerulafifanto@gmail.com>
Repository: CRAN
Date/Publication: 2023-12-04 16:40:02 UTC
Date/Publication: 2023-12-14 05:10:02 UTC
8 changes: 4 additions & 4 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
302d5240a8e5f5a04f85763d8778e804 *DESCRIPTION
9d09d251cf7116729543d87999740a3f *DESCRIPTION
0a0864f9583c81707387e99a5d9b6205 *LICENSE
9ca8510dff33972e0aecd72870dcbf83 *NAMESPACE
fb7bd8c537c2f118b1669265e12f2be2 *NEWS.md
db949ea49f20bd997a2566eb21b18bc5 *NEWS.md
1dd792b86cbd22c58d3b414c76895b90 *R/data.R
6c99f077dc69186674f3dadcd1eb9801 *R/global.R
be9443838d2d4030c433574eb607a2ab *R/samplingin.R
85c1a597b16eb66671d3d6574c0af1a3 *R/samplingin.R
b607675a460f815c9e9341f4b711f668 *README.md
36b7c180d46df42cdcfd4bc6d3584568 *data/alokasi_dt.rda
52dad9ede25dd9a0ece1aa7182a5f6d6 *data/pop_dt.rda
eaf28cc3ddfb8a5b6cc7508cb0eca3e9 *man/alokasi_dt.Rd
ad4c84914a432920d76beedb22e5c198 *man/doSampling.Rd
3896a631ed872eef612def668c26ff05 *man/doSampling.Rd
8ffcac8f5702dde07851f3b46c92833a *man/get_allocation.Rd
be582494882c81e41c2cfdf56b210984 *man/pop_dt.Rd
10a69c815bc7997021d957f4e85fdb99 *man/round_preserve_sum.Rd
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# samplingin 1.0.3

# samplingin 1.0.2

# samplingin 1.0.1

# samplingin 1.0.0
Expand Down
25 changes: 20 additions & 5 deletions R/samplingin.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ createInterval = function(pop, method, strata, auxVar=NA, groupByVar=c("kdprov",
#' @param pop pop dataframe
#' @param alloc allocation dataframe
#' @param nsampel variable on alloc df as allocation sample
#' @param type type value for sample classification ('U' = Utama, 'P' = pengganti)
#' @param type type value for sample classification ('U' = Primary Samples, 'P' = Secondary Samples)
#' @param strata strata variable, must available on both pop and alloc dataframe
#' @param ident group by on allocation dataframe
#' @param implicitby variable used as implicit stratification
Expand Down Expand Up @@ -293,7 +293,10 @@ doSampling = function(pop, alloc, nsampel, type, strata=NULL, ident=c("kdprov","
return()
}

null_strata = 0

if(is.null(strata)){
null_strata = 1
pop = pop %>%
mutate(tmp_strata = as.integer(1))

Expand All @@ -304,11 +307,23 @@ doSampling = function(pop, alloc, nsampel, type, strata=NULL, ident=c("kdprov","
}

if( !is.null(implicitby) ){
sortVar = c(ident, implicitby)
if(verbose) message("sort by:",ident,"and",implicitby,"\n")
sortVar = c(ident, strata, implicitby)
if(verbose){
if(!null_strata){
message("sort by: ",ident,", ",strata," and ",implicitby,"\n")
}else{
message("sort by: ",ident," and ",implicitby,"\n")
}
}
}else{
sortVar = ident
if(verbose) message("no implicit stratification variable chosen, sort by: ",ident,"\n")
sortVar = c(ident, strata)
if(verbose){
if(!null_strata){
message("no implicit stratification variable chosen, sort by: ",ident," and ",strata,"\n")
}else{
message("no implicit stratification variable chosen, sort by: ",ident,"\n")
}
}
}

pop = pop %>%
Expand Down
2 changes: 1 addition & 1 deletion man/doSampling.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6fde9e2

Please sign in to comment.