---
title: "Participation of HSE students around the world"
author: "Statistics course 2020/2021 at TU Dresden"
date: "Date: 2021-02-04"
output: html_document
---

```{r setup, include=FALSE}
#knitr::opts_chunk$set(echo = TRUE)
library(rgl)
setupKnitr(autoprint = TRUE)
```

```{r, echo=FALSE}
## students 2021
coord <- read.csv("hse2021.csv")
```

```{r echo=FALSE}
lat <- matrix(seq(90, -90, len = 50)*pi/180, 50, 50, byrow = TRUE)
lon <- matrix(seq(-180, 180, len = 50)*pi/180, 50, 50)
r <- 6378.1 # radius of Earth in km
x <- r*cos(lat)*cos(lon)
y <- r*cos(lat)*sin(lon)
z <- r*sin(lat)

lat <- coord$latitude
lon <- coord$longitude
foreign <- !(coord$currently %in% c("Dresden", "Freital"))

x1 <- r*cos(lat * pi/180)*cos(lon * pi/180)
y1 <- r*cos(lat * pi/180)*sin(lon * pi/180)
z1 <- r*sin(lat * pi/180)

z1 <- r * sin(lat * pi/180)

persp3d(x, y, z, col = "white",
        #texture = system.file("textures/world.png", package = "rgl"),
        #texture = "world_light.png",
        texture = "world_topo.png",
        specular = "black", axes = FALSE, box = FALSE, xlab = "",
        ylab = "", zlab = "", normal_x = x, normal_y = y, normal_z = z)

spheres3d(x1, y1, z1 + 50, radius=100, col=c("#009de0", "#93107d")[1+foreign])

## TU Dresden
lat <- 51.029
lon <- 13.729
spheres3d(
  r*cos(lat * pi/180)*cos(lon * pi/180),
  r*cos(lat * pi/180)*sin(lon * pi/180),
  r*sin(lat * pi/180) + 75,
  radius=150, col=c("#00305d")
)
```

### Explanation
* The 3D globe can be rotated and zoomed with the mouse.
* Number of course members displayed in this map: **`r nrow(coord)`**
* Course supervisor and 2 tutors included, some dots represent several students.



### Notes

* blue dots: origin of people who are currently in Dresden
* dark blue: location of Technische Universität Dresden
* red dots: students who participate remotely from their home countries
* coordinates unchecked, without warranty

### Exercise

Some dots represent several people. Find a way to vizualize this, e.g. by
scaling the dots. Here is the **[source code](globe-hse-2021.Rmd)**.
In case of questions send me an [email](mailto:thomas.petzoldt@tu-dresden.de).
