Articles by R & Census

Benford’s Law and Census Data

November 10, 2020 | R & Census

Benford’s law attracted lots of attention after the 2020 election, as some people attempted to use this law to question the integrity of the election. Benford’s law states that the frequency of the first digit of a large set of numerical data follows this rule: 30.1% are 1s, 17.6% are 2s, 12.5% ... [Read more...]

Build a static website with R Shiny

April 12, 2020 | R & Census

Sounds stupid? Yes, it’s kind of throwing away 99% of Shiny’s power; and you can always build a static website with R markdown, blogdown, or bookdown. Anyway, please keep reading as it will save you time if you are an R users who want to make a portfolio website ... [Read more...]

Navigate through Decennial Census and American Community Survey

February 2, 2019 | R & Census

Finding the right content in census data can be daunting. Just give you an idea how complex the census data are, there are 1127 tables and 25070 columns of table contents in the 2012-2017 ACS 5-year summary file alone. dataset number of tables number of columns 2010 decennial census summary file 1 333 8959 2012-2017 5-year ... [Read more...]

Cities boomed and doomed

December 14, 2018 | R & Census

Population in the United States grew by 3.76% from 313.91 million in 2012 to 325.72 million in 2017. The growth, however, is not uniform geographically. One of the geographical areas of particular interest is the city. Some cities are shrinking in population while some others exploding. The purpose of this post is to find cities ... [Read more...]

Find Salamander — Congressional District Gerrymandering

October 22, 2018 | R & Census

When Republicans or Democrats are in charge, they tend to draw election district boundaries to their favor. This can go very ugly, creating wacky boundaries by a practice called Gerrymandering. The word “Gerrymander” is a blend of two species: the Massachusetts Governor Elbridge Gerry and a mythological salamander, a dragon-like ... [Read more...]

Map prisons in the United States

February 4, 2018 | R & Census

Despite 1 in every 110 adults are locked behind bars, most ordenary people have no idea where are these prisons. This post helps you find out the location of and number of inmates in federal prisons, state prisons, and local jails. The data are extracted from Census 2010. According to the census, a ... [Read more...]

Is your hometown named after Lincoln or Washington?

January 26, 2018 | R & Census

Washington and Lincoln are the two greatest presidents in the history of the United States. This post, however, does not discuss how great they are. Instead, I want to show a fun fact related the two presidents: how many cities and towns (and equivalents) are named after them. I am ... [Read more...]

Build a R package for yourself

September 13, 2017 | R & Census

A R user can benefit a lot from building packages. I have read people writing about the benefit in various occasions and cannot agree more after building my first package. We don’t have to a be R developer to write packages. Developers write packages for others; we can just ... [Read more...]

ggplot2: place text at right location

August 17, 2017 | R & Census

A common task in plotting is adding texts as labels or annotations to specific locations. ggplot() has functions geom_text(), geom_label() and annotate() for this purpose. In this post we discuss how ggplot2 controls positioning of text. First we need to specify (x, y) coordinate in the plot where ... [Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)