[acs-r] Sort acs object before plotting?
Ezra Haber Glenn
eglenn at mit.edu
Tue Oct 25 14:32:14 EDT 2016
Great question. The trick would be to use order() as an index vector
inside square brackets. So if my.data is a acs object and you want to
plot the first column, an unsorted plot would be:
> plot(my.data[,1])
and a sorted plot might be
> plot(my.data[order(estimate(my.data[,1])),1])
should do the trick.
If you're doing a bunch of this sort of thing, or maybe if you want to
plot one column based on the order of another (say, the percentage of
commuters in a tract, by order of the median HH income of the tracts),
you could save the indices:
> my.index=order(estimate(my.data[,1]))
> plot(my.data[my.index, 1])
--Ezra
On Tue, 25 Oct 2016 11:31:07 -0400, Tiernan Martin wrote:
>
> [1 <multipart/related (7bit)>]
> [1.1 <multipart/alternative (7bit)>]
> [1.1.1 <text/plain; UTF-8 (7bit)>]
> [1.1.2 <text/html; UTF-8 (quoted-printable)>]
> I love the plotting method that the acs package implements, but if an acs object has many
> records the resulting graph can be difficult to understand (see below).
>
> acs-grap
>
> Is there a good way for arranging the records so that the graph shows them in ascending
> order? My efforts to use `sort()` and `dplyr::arrange()` have all resulted in errors.
>
> Thanks,
>
> Tiernan
>
>
> [2 <text/plain; us-ascii (7bit)>]
> _______________________________________________
> acs-r mailing list
> acs-r at mit.edu
> http://mailman.mit.edu/mailman/listinfo/acs-r
--
Ezra Haber Glenn, AICP
Department of Urban Studies and Planning
Massachusetts Institute of Technology
77 Massachusetts Ave., Room 7-346
Cambridge, MA 02139
eglenn at mit.edu
http://dusp.mit.edu/faculty/ezra-glenn | http://eglenn.scripts.mit.edu/citystate/
617.253.2024 (w)
617.721.7131 (c)
More information about the acs-r
mailing list