Weitere Kapitel dieses Buchs durch Wischen aufrufen
We’ve tried to make this User Guide as detailed as possible, to help you learn about the many advanced features of the new package. As a result, it may look like there is a lot to learn, but in fact the basics are pretty simple: to get ACS data for your own user-defined geographies, all you need to do is:
Bitte loggen Sie sich ein, um Zugang zu diesem Inhalt zu erhalten
Sie möchten Zugang zu diesem Inhalt erhalten? Dann informieren Sie sich jetzt über unsere Produkte:
Note: for reasons that will become clear in a moment, even a single geographic unit—say, one specific tract or county—will be wrapped up as a geo.set. Technically, each individual element in the set is known as a geo, but users will rarely (if ever) interact will individual elements such as this; wrapping all groups of geographies—even groups consisting of just one element—in geo.sets like this will help make them easier to deal with as the geographies get more complex. To avoid extra words here, I may occasionally ignore this distinction and refer to user-created geo.sets as “geos.”
This seemed preferable to simply including both matches, since all sorts of place names might match a string, and it is doubtful a user really wants them all.
All this combining and relabeling takes place when the actual data is downloaded, so up until then you can continue to change and re-change the structure of your geo.sets.
By default, the new set will have combine=FALSE, with one exception: when adding a single-geography (i.e., length==1) to an existing set with combine= already set to TRUE, the new set will keep combine=TRUE, essentially “folding in” the new geography.
Or combine()<- and combine.term()<-, for R traditionalists…
At present, geo.lookup() only accepts and searches on state=, county=, county.subdivision=, and place=; eventually we hope to include lookup support to help find tract and block.group numbers as well.
At present, the function breaks on the first non-match, without a whole lot of help; in the future I’ll add in some better error-handling for this.
Actually, you could download data even without creating a geo.set object first— R’s evaluation procedures are perfectly happy letting you use geo.make() “on the fly” and passing the results to the acs.fetch() function: you could enter something like acs.fetch(endyear=2013, geography=geo.make(state="WA", county ="*"), table.number="B01003").
And if you haven’t, you can simply add a key= argument each time.
Note: At the request of some users, the acs package includes a special one.zero= option for the sum function, which may be desirable when aggregating lots of variables with zero-values for estimates. Since acs.fetch calls sum internally, you can set this option when you call acs.fetch and it will be passed along: for example, one could type acs.fetch(geo=my.geos, endyear=2011, table.number="B08013", one.zero=T). See help(sum-methods) for more on this.
Users may set span=1 or span=3 for other ACS products, or span=0 for Decennial data; similarly, use dataset="sf1" or dataset="sf3" for other census products.
SF3 was discontinued after 2000 and replaced with the ACS.
But don’t lose hope: see Sect. 3.3.3 on the acs.lookup() tool, which can help with this problem.
- Working with the New Functions
Ezra Haber Glenn
- Chapter 3
Neuer Inhalt/© ITandMEDIA