Geographical Distribution of Students' Hometown in Ji'nan University

Geographical Distribution of Students' Hometown in Ji'nan University

This tweet demonstrates a simple application of ‘hchinamap’ package. The data was collect from Ji’nan University’s library websit and sport website. Considering that this is a data set with private information, I can’t make this data public. If you want a copy, you can add my wechat to ask for it.

First, load this data into memory:

R
1
2
3
4
5
6
7
8
9
10
11
library(readstata13)
library(tidyverse)
library(hchinamap)
jnu <- read.dta13("暨南大学学生信息表.dta") %>% as_tibble()

df <- jnu %>%
dplyr::filter(!is.na(经度)) %>%
mutate(id = rownames(.)) %>%
select(年级, 经度, 纬度, id) %>%
sample_n(4000) %>%
arrange(年级)

This data is like this:

年级 经度 纬度 id
1年级 113.6128 37.85787 6103
1年级 106.7242 26.54141 9500
1年级 123.3586 41.80572 8434
1年级 102.3287 38.49217 7714
1年级 114.8269 23.93305 10056
1年级 113.7677 23.34674 5403

Next, we can use hchinamap to mark every student’s location on Chinese map:

1
2
3
4
chinamappoint(cat = df$年级, name = df$id, 
lat = df$纬度, lon = df$经度,
subtitle = "Data Source: Ji'nan University",
title = "Geographical Distribution of Students' Hometown in Ji'nan University", headerFormat = "<small>Someone:</small><table>", pointFormat = "<tr><td>Grade:</td><td>: {series.name}</td></tr><tr>")

Explore it in an interactive view: jinan.html

Since I come from Anhui province, I want to know the geographical distribution of Anhui province students:

1
2
3
4
5
6
7
8
9
10
11
12
13
df <- jnu %>%
dplyr::filter(省份 == "安徽") %>%
dplyr::filter(!is.na(经度)) %>%
mutate(id = rownames(.)) %>%
select(年级, 经度, 纬度, id) %>%
arrange(年级)

provincepoint(cat = df$年级, name = df$id,
lat = df$纬度, lon = df$经度,
title = "Geographical Distribution of Anhui Province Students' Hometown in Ji'nan University",
headerFormat = "<small>Someone: </small><table>",
pointFormat = "<tr><td>Grade</td><td>: {series.name}</td></tr><tr>",
region = "anhui", markerRadius = 5)

I just saw myself!

# R

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×