Skip to content

Commit

Permalink
Added logo
Browse files Browse the repository at this point in the history
  • Loading branch information
marberts committed Nov 15, 2023
1 parent 4bf6c56 commit 6cb3706
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
^_pkgdown\.yml$
^docs$
^pkgdown$
^man/figures$
^inst/logo\.R$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.vscode
docs
inst/doc
pkgdown
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: "Sequential Poisson Sampling"
output: github_document
---

Expand All @@ -13,6 +12,8 @@ knitr::opts_chunk$set(
)
```

# Sequential Poisson sampling <a href="https://marberts/github.io/sps/"><img src="man/figures/logo.png" align="right" height="139" alt="sps website" /></a>

[![CRAN status](https://www.r-pkg.org/badges/version/sps)](https://cran.r-project.org/package=sps)
[![sps status badge](https://marberts.r-universe.dev/badges/sps)](https://marberts.r-universe.dev)
[![R-CMD-check](https://github.com/marberts/sps/workflows/R-CMD-check/badge.svg)](https://github.com/marberts/sps/actions)
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Sequential Poisson Sampling
================

<!-- README.md is generated from README.Rmd. Please edit that file. -->

# Sequential Poisson sampling <a href="https://marberts/github.io/sps/"><img src="man/figures/logo.png" align="right" height="139" alt="sps website" /></a>

[![CRAN
status](https://www.r-pkg.org/badges/version/sps)](https://cran.r-project.org/package=sps)
[![sps status
Expand Down Expand Up @@ -54,11 +54,11 @@ revenue <- c(1:10, 100, 150)

# Draw a sample of 6 businesses
(samp <- sps(revenue, 6))
#> [1] 4 8 9 10 11 12
#> [1] 1 7 9 10 11 12

# Design weights and sampling strata are stored with the sample
weights(samp)
#> [1] 3.437500 1.718750 1.527778 1.375000 1.000000 1.000000
#> [1] 13.750000 1.964286 1.527778 1.375000 1.000000 1.000000
levels(samp)
#> [1] "TS" "TS" "TS" "TS" "TA" "TA"
```
Expand All @@ -78,10 +78,10 @@ stratum <- rep(c("a", "b"), c(9, 3))

# Draw a stratified sample
(samp <- sps(revenue, allocation, stratum))
#> [1] 5 6 9 10 11 12
#> [1] 6 8 9 10 11 12

weights(samp)
#> [1] 3.000000 2.500000 1.666667 1.000000 1.000000 1.000000
#> [1] 2.500000 1.875000 1.666667 1.000000 1.000000 1.000000
levels(samp)
#> [1] "TS" "TS" "TS" "TA" "TA" "TA"
```
Expand All @@ -91,13 +91,13 @@ replicate weights with the `sps_repweights()` function.

``` r
sps_repweights(weights(samp), 5, tau = 2)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1.500000 4.50 1.5 4.50 3.0
#> [2,] 1.500000 2.25 4.0 2.25 4.0
#> [3,] 2.333333 1.50 2.0 1.50 1.5
#> [4,] 1.000000 1.00 1.0 1.00 1.0
#> [5,] 1.000000 1.00 1.0 1.00 1.0
#> [6,] 1.000000 1.00 1.0 1.00 1.0
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 2.250000 2.2500 1.500 2.750000 3.5000000
#> [2,] 0.875000 1.8125 0.875 1.812500 2.7500000
#> [3,] 2.333333 1.5000 2.000 1.166667 0.6666667
#> [4,] 1.000000 1.0000 1.000 1.000000 1.0000000
#> [5,] 1.000000 1.0000 1.000 1.000000 1.0000000
#> [6,] 1.000000 1.0000 1.000 1.000000 1.0000000
#> attr(,"tau")
#> [1] 2
```
Expand Down
19 changes: 19 additions & 0 deletions inst/logo.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
library(ggplot2)
library(hexSticker)

gg <- ggplot(data.frame(x = 1:5, y = 1:5, f = factor(c(1, 1, 1, 2, 2)))) +
geom_col(aes(x, y, fill = f)) +
scale_fill_manual(values = c("#5C5858", "#B6B6B4")) +
guides(fill = "none") +
theme_void()

sticker(gg,
package = "sps",
filename = "man/figures/logo.png",
s_x = 1,
s_width = 1,
p_size = 18,
p_family = "mono",
p_color = "#245B37",
h_fill = "#E2A328",
h_color = "#245B37")
Binary file added man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6cb3706

Please sign in to comment.