From 71ec6e5f35a4e1f5c268c9ff635ddb11bd1f62dc Mon Sep 17 00:00:00 2001
From: christopherkenny Copyright (c) 2021 Christopher T. Kenny Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Kenny C (2022).
+ Kenny C (2023).
censable: Making Census Data More Usable.
-https://christophertkenny.com/censable/, https://github.com/christopherkenny/censable.
+R package version 0.0.5, https://github.com/christopherkenny/censable, https://christophertkenny.com/censable/.
Page not found (404)
diff --git a/LICENSE-text.html b/LICENSE-text.html
index b83e48b..292f92d 100644
--- a/LICENSE-text.html
+++ b/LICENSE-text.html
@@ -65,7 +65,7 @@ License
diff --git a/LICENSE.html b/LICENSE.html
index 3aa3ea2..53ff14a 100644
--- a/LICENSE.html
+++ b/LICENSE.html
@@ -47,6 +47,7 @@ MIT License
MIT License
Citation
- @Manual{,
title = {censable: Making Census Data More Usable},
author = {Christopher T. Kenny},
- year = {2022},
- note = {https://christophertkenny.com/censable/, https://github.com/christopherkenny/censable},
+ year = {2023},
+ note = {R package version 0.0.5, https://github.com/christopherkenny/censable},
+ url = {https://christophertkenny.com/censable/},
}
@@ -83,7 +84,7 @@ Citation
diff --git a/index.html b/index.html
index 6d114d6..8ae4f45 100644
--- a/index.html
+++ b/index.html
@@ -79,6 +79,7 @@
+
censable
wraps censusapi
for common requests, with memoized data functions. With a growing redistricting universe in R, it seems right to partition out some use cases, to allow imports to be more targeted and to stop packages from repeating each other.Installation
@@ -146,6 +147,7 @@
Developers
Dev status
@@ -162,7 +164,7 @@ Dev status
diff --git a/news/index.html b/news/index.html
index 0bbc64d..4b5a2b4 100644
--- a/news/index.html
+++ b/news/index.html
@@ -47,6 +47,10 @@ Changelog
Source: NEWS.md
censable 0.0.52022-11-19
+censable 0.0.4
build_dec()
and build_acs()
to make variable fetching cleaner.censable 0.0.3
Examples
diff --git a/reference/breakdown_geoid.html b/reference/breakdown_geoid.html
index f127a83..cd5c864 100644
--- a/reference/breakdown_geoid.html
+++ b/reference/breakdown_geoid.html
@@ -98,7 +98,7 @@ Examples
diff --git a/reference/build_acs.html b/reference/build_acs.html
index 2513f28..abd61f3 100644
--- a/reference/build_acs.html
+++ b/reference/build_acs.html
@@ -217,7 +217,7 @@ Examples
diff --git a/reference/build_dec.html b/reference/build_dec.html
index f590d4a..6e46f61 100644
--- a/reference/build_dec.html
+++ b/reference/build_dec.html
@@ -175,7 +175,7 @@ Examples
diff --git a/reference/collapse4.html b/reference/collapse4.html
index d261878..09956b3 100644
--- a/reference/collapse4.html
+++ b/reference/collapse4.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/collapse4_pop.html b/reference/collapse4_pop.html
index 0fc9f4f..502ab30 100644
--- a/reference/collapse4_pop.html
+++ b/reference/collapse4_pop.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/collapse4_vap.html b/reference/collapse4_vap.html
index 5636098..978ae59 100644
--- a/reference/collapse4_vap.html
+++ b/reference/collapse4_vap.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/collapse5.html b/reference/collapse5.html
index 3445b17..cd5c08c 100644
--- a/reference/collapse5.html
+++ b/reference/collapse5.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/collapse5_pop.html b/reference/collapse5_pop.html
index 62b6f47..a3f19ab 100644
--- a/reference/collapse5_pop.html
+++ b/reference/collapse5_pop.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/collapse5_vap.html b/reference/collapse5_vap.html
index 47c55a6..cb68d6b 100644
--- a/reference/collapse5_vap.html
+++ b/reference/collapse5_vap.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/construct_geoid.html b/reference/construct_geoid.html
index 06632be..8b7a5a9 100644
--- a/reference/construct_geoid.html
+++ b/reference/construct_geoid.html
@@ -145,7 +145,7 @@ Examples
diff --git a/reference/custom_geoid.html b/reference/custom_geoid.html
index e63e4fd..c803e35 100644
--- a/reference/custom_geoid.html
+++ b/reference/custom_geoid.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/fips_2000.html b/reference/fips_2000.html
index 6fd521f..e309aef 100644
--- a/reference/fips_2000.html
+++ b/reference/fips_2000.html
@@ -87,7 +87,7 @@ Examples
diff --git a/reference/fips_2010.html b/reference/fips_2010.html
index a0a1bca..b3c3c2a 100644
--- a/reference/fips_2010.html
+++ b/reference/fips_2010.html
@@ -87,7 +87,7 @@ Examples
diff --git a/reference/fips_2020.html b/reference/fips_2020.html
index f362de0..51cfa97 100644
--- a/reference/fips_2020.html
+++ b/reference/fips_2020.html
@@ -87,7 +87,7 @@ Examples
diff --git a/reference/index.html b/reference/index.html
index 8702a32..3e2b654 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -275,7 +275,7 @@ Other
diff --git a/reference/join_abb_ansi.html b/reference/join_abb_ansi.html
index e817ccf..13f678b 100644
--- a/reference/join_abb_ansi.html
+++ b/reference/join_abb_ansi.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_abb_fips.html b/reference/join_abb_fips.html
index 83c4024..5299e65 100644
--- a/reference/join_abb_fips.html
+++ b/reference/join_abb_fips.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_abb_name.html b/reference/join_abb_name.html
index 5c7c7df..ada74ba 100644
--- a/reference/join_abb_name.html
+++ b/reference/join_abb_name.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_ansi_abb.html b/reference/join_ansi_abb.html
index c0df5f4..78c4dc7 100644
--- a/reference/join_ansi_abb.html
+++ b/reference/join_ansi_abb.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_ansi_fips.html b/reference/join_ansi_fips.html
index 3cb3fe4..e15952f 100644
--- a/reference/join_ansi_fips.html
+++ b/reference/join_ansi_fips.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_ansi_name.html b/reference/join_ansi_name.html
index 408ce66..30e291f 100644
--- a/reference/join_ansi_name.html
+++ b/reference/join_ansi_name.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_fips_abb.html b/reference/join_fips_abb.html
index 041977d..05bfe1d 100644
--- a/reference/join_fips_abb.html
+++ b/reference/join_fips_abb.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_fips_ansi.html b/reference/join_fips_ansi.html
index 1368e2d..198b67b 100644
--- a/reference/join_fips_ansi.html
+++ b/reference/join_fips_ansi.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_fips_name.html b/reference/join_fips_name.html
index a3be473..751f1fb 100644
--- a/reference/join_fips_name.html
+++ b/reference/join_fips_name.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_name_abb.html b/reference/join_name_abb.html
index 0829917..a9bc7ea 100644
--- a/reference/join_name_abb.html
+++ b/reference/join_name_abb.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_name_ansi.html b/reference/join_name_ansi.html
index 835d89c..e02b62a 100644
--- a/reference/join_name_ansi.html
+++ b/reference/join_name_ansi.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/join_name_fips.html b/reference/join_name_fips.html
index a6b9397..c7bb8f9 100644
--- a/reference/join_name_fips.html
+++ b/reference/join_name_fips.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/key.html b/reference/key.html
index 534f61e..80c033f 100644
--- a/reference/key.html
+++ b/reference/key.html
@@ -91,7 +91,7 @@ Examples
diff --git a/reference/match_abb.html b/reference/match_abb.html
index 6456b33..4796ae8 100644
--- a/reference/match_abb.html
+++ b/reference/match_abb.html
@@ -89,7 +89,7 @@ Examples
diff --git a/reference/match_ansi.html b/reference/match_ansi.html
index 28a6375..03f4c61 100644
--- a/reference/match_ansi.html
+++ b/reference/match_ansi.html
@@ -89,7 +89,7 @@ Examples
diff --git a/reference/match_fips.html b/reference/match_fips.html
index 4e0299e..f817751 100644
--- a/reference/match_fips.html
+++ b/reference/match_fips.html
@@ -89,7 +89,7 @@ Examples
diff --git a/reference/match_name.html b/reference/match_name.html
index 33904a0..4cee6ab 100644
--- a/reference/match_name.html
+++ b/reference/match_name.html
@@ -89,7 +89,7 @@ Examples
diff --git a/reference/mt_county.html b/reference/mt_county.html
index 875b659..2c54fa6 100644
--- a/reference/mt_county.html
+++ b/reference/mt_county.html
@@ -125,7 +125,7 @@ Examples
diff --git a/reference/pipe.html b/reference/pipe.html
index 1d434f9..fff98ca 100644
--- a/reference/pipe.html
+++ b/reference/pipe.html
@@ -85,7 +85,7 @@ Value
diff --git a/reference/recode_abb_ansi.html b/reference/recode_abb_ansi.html
index 4706415..62e044d 100644
--- a/reference/recode_abb_ansi.html
+++ b/reference/recode_abb_ansi.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_abb_fips.html b/reference/recode_abb_fips.html
index e7b4960..b7a1fe2 100644
--- a/reference/recode_abb_fips.html
+++ b/reference/recode_abb_fips.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_abb_name.html b/reference/recode_abb_name.html
index f8d789c..4c3e2f4 100644
--- a/reference/recode_abb_name.html
+++ b/reference/recode_abb_name.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_ansi_abb.html b/reference/recode_ansi_abb.html
index 46c88a9..7ac9ecc 100644
--- a/reference/recode_ansi_abb.html
+++ b/reference/recode_ansi_abb.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/recode_ansi_fips.html b/reference/recode_ansi_fips.html
index ccc73f9..24d2214 100644
--- a/reference/recode_ansi_fips.html
+++ b/reference/recode_ansi_fips.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_ansi_name.html b/reference/recode_ansi_name.html
index bd44d28..84b3d1d 100644
--- a/reference/recode_ansi_name.html
+++ b/reference/recode_ansi_name.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_fips_abb.html b/reference/recode_fips_abb.html
index ab4cbda..1a45549 100644
--- a/reference/recode_fips_abb.html
+++ b/reference/recode_fips_abb.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_fips_ansi.html b/reference/recode_fips_ansi.html
index 66d016a..ca7d1aa 100644
--- a/reference/recode_fips_ansi.html
+++ b/reference/recode_fips_ansi.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_fips_name.html b/reference/recode_fips_name.html
index e69c203..e522af5 100644
--- a/reference/recode_fips_name.html
+++ b/reference/recode_fips_name.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_name_abb.html b/reference/recode_name_abb.html
index e36d02a..92400ab 100644
--- a/reference/recode_name_abb.html
+++ b/reference/recode_name_abb.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/recode_name_ansi.html b/reference/recode_name_ansi.html
index ad6b2c7..7123172 100644
--- a/reference/recode_name_ansi.html
+++ b/reference/recode_name_ansi.html
@@ -149,7 +149,7 @@ Examples
diff --git a/reference/recode_name_fips.html b/reference/recode_name_fips.html
index f57ad99..44ad992 100644
--- a/reference/recode_name_fips.html
+++ b/reference/recode_name_fips.html
@@ -207,7 +207,7 @@ Examples
diff --git a/reference/stata.html b/reference/stata.html
index 9efa065..2ed97a9 100644
--- a/reference/stata.html
+++ b/reference/stata.html
@@ -93,7 +93,7 @@ Examples
diff --git a/reference/tidyeval.html b/reference/tidyeval.html
index d2b623b..cf330c6 100644
--- a/reference/tidyeval.html
+++ b/reference/tidyeval.html
@@ -136,27 +136,27 @@ Tidy eval helpers
passed from function arguments inside other tidy eval functions.
{{
is designed for individual arguments. To pass multiple
arguments contained in dots, use ...
in the normal way.
my_function <- function(data, var, ...) {
- data %>%
- group_by(...) %>%
- summarise(mean = mean({{ var }}))
-}
<- function(data, var, ...) {
+ my_function %>%
+ data group_by(...) %>%
+ summarise(mean = mean({{ var }}))
+ }
enquo()
and enquos()
delay the execution of one or several
function arguments. The former returns a single expression, the
latter returns a list of expressions. Once defused, expressions
will no longer evaluate on their own. They must be injected back
into an evaluation context with !!
(for a single expression) and
!!!
(for a list of expressions).
my_function <- function(data, var, ...) {
- # Defuse
- var <- enquo(var)
- dots <- enquos(...)
-
- # Inject
- data %>%
- group_by(!!!dots) %>%
- summarise(mean = mean(!!var))
-}
<- function(data, var, ...) {
+ my_function # Defuse
+ <- enquo(var)
+ var <- enquos(...)
+ dots
+# Inject
+ %>%
+ data group_by(!!!dots) %>%
+ summarise(mean = mean(!!var))
+ }
In this simple case, the code is equivalent to the usage of {{
and ...
above. Defusing with enquo()
or enquos()
is only
needed in more complex cases, for instance if you need to inspect
@@ -164,29 +164,29 @@
The .data
pronoun is an object that represents the current
slice of data. If you have a variable name in a string, use the
.data
pronoun to subset that variable with [[
.
<- "disp"
+ my_var %>% summarise(mean = mean(.data[[my_var]])) mtcars
Another tidy eval operator is :=
. It makes it possible to use
glue and curly-curly syntax on the LHS of =
. For technical
reasons, the R language doesn't support complex expressions on
the left of =
, so we use :=
as a workaround.
<- function(data, var, suffix = "foo") {
+ my_function # Use `{{` to tunnel function arguments and the usual glue
+ # operator `{` to interpolate plain strings.
+ %>%
+ data summarise("{{ var }}_mean_{suffix}" := mean({{ var }}))
+ }
Many tidy eval functions like dplyr::mutate()
or
dplyr::summarise()
give an automatic name to unnamed inputs. If
you need to create the same sort of automatic names by yourself,
use as_label()
. For instance, the glue-tunnelling syntax above
can be reproduced manually with:
my_function <- function(data, var, suffix = "foo") {
- var <- enquo(var)
- prefix <- as_label(var)
- data %>%
- summarise("{prefix}_mean_{suffix}" := mean(!!var))
-}
<- function(data, var, suffix = "foo") {
+ my_function <- enquo(var)
+ var <- as_label(var)
+ prefix %>%
+ data summarise("{prefix}_mean_{suffix}" := mean(!!var))
+ }
Expressions defused with enquo()
(or tunnelled with {{
) need
not be simple column names, they can be arbitrarily complex.
as_label()
handles those cases gracefully. If your code assumes
@@ -208,7 +208,7 @@