Learn R Programming

acs (version 0.5)

acs-class: Class "acs"

Description

The acs class provides a convenient wrapper for data from the U.S. Census American Community Survey. Estimates and standard errors are kept together, along with metadata necessary to manipulate and analyze data in this form.

Arguments

Objects from the Class

Objects can be created by calls of the form new("acs", ...), or through helper functions provided by the package (currently only read.acs). Once created, acs objects can be manipulated through new methods to deal appropriately with common analytical tasks such as combining subgroups or geographies, mathematical operations on estimates, tests of significance, and computing (and eventually plotting) confidence intervals.

Examples

Run this code
showClass("acs")
# load some data from the ACS
data(kansas09)
str(kansas09)

# access slots
endyear(kansas09)
span(kansas09)
estimate(kansas09)[1:5,1:5]
standard.error(kansas09[1:5,1:5])


# subset
kansas09[1:4,6:9]

# more complicated subsets
kansas09[c("Linn County, Kansas", "Wilson County, Kansas") , grep(pattern="21.years", x=acs.colnames(kansas09))]

# addition on estimates and errors
kansas09[1:4,25]+kansas09[1:4,49]

# can even multiply and divided
# males per female, by county
kansas09[1:4,2]/kansas09[1:4,26]

# (males<5 plus females<5) * 12
(kansas09[7,3]+kansas09[7,27]) * 15

Run the code above in your browser using DataLab