Code Monkey home page Code Monkey logo

nzmigration's Introduction

nzmigration

The nzmigration R package contains a single dataset, nz_internal_migration_summary, of summary statistics about internal migration in New Zealand from the 2013 census, from the Spreadsheet File published by Statistics New Zealand.

This is not an official package of the New Zealand government and is not associated with the New Zealand government in any way.

The data was extracted from the spreadsheet by using the tidyxl and unpivotr packages.

Installation

You can install nzmigration from github with:

# install.packages("devtools")
devtools::install_github("nacnudus/nzmigration")

Example

library(nzmigration)
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(scales))

nz_internal_migration_summary %>%
  filter(table == "Table18",
         var2 == "People of Māori Ethnicity",
         var3 == "Total",
         var5 == "Total",
         var6 != "Total") %>%
  separate(var6, c("age", "year"), sep = " ", extra = "drop") %>%
  select(-year) %>%
  select(var4, age, count) %>%
  spread(var4, count) %>%
  mutate_at(-1, `/`, .$Total) %>%
  select(-Total) %>%
  gather(var4, percent, -age) %>%
  ggplot(aes(age, percent)) +
  geom_bar(stat = "identity") +
  facet_wrap(~var4, scales = "free_y") +
  scale_y_continuous(labels = percent) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
#> Warning: Removed 1 rows containing missing values (position_stack).

nzmigration's People

Contributors

nacnudus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.