Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e68ab81
Create cv
SebnemEr Dec 4, 2017
f485480
Create courses.html
SebnemEr Oct 2, 2020
8eb0f16
Create 20100929Lab1.txt
SebnemEr Oct 2, 2020
1afdc49
Create 20122013GuzProgram.docx
SebnemEr Oct 2, 2020
d292c80
Create a-visualisation-map-weights-onto-colors.html
SebnemEr Oct 2, 2020
5b23355
Create applications.html
SebnemEr Oct 2, 2020
33cee58
Create association-rules.html
SebnemEr Oct 2, 2020
b69c1aa
Create nice-fig-1.png
SebnemEr Oct 2, 2020
a146235
Create unnamed-chunk-14-1.png
SebnemEr Oct 2, 2020
1ce255e
Create unnamed-chunk-18-1.png
SebnemEr Oct 2, 2020
eaaeb76
Create unnamed-chunk-17-1.png
SebnemEr Oct 2, 2020
3cfd6a7
Create unnamed-chunk-19-1.png
SebnemEr Oct 2, 2020
10a2f34
Create unnamed-chunk-7-1.png
SebnemEr Oct 2, 2020
5ec8287
Create unnamed-chunk-8-1.png
SebnemEr Oct 2, 2020
c619156
Create unnamed-chunk-9-1.png
SebnemEr Oct 2, 2020
57c5977
Create cluster-analysis.html
SebnemEr Oct 2, 2020
d074980
Create compute-pairewise-distance-matrices.html
SebnemEr Oct 2, 2020
71e305c
Create example.png
SebnemEr Oct 2, 2020
fc070ba
Create final-words.html
SebnemEr Oct 2, 2020
6258562
Create index.html
SebnemEr Oct 2, 2020
a928c50
Create intro.html
SebnemEr Oct 2, 2020
84c703b
Create empty-anchor.js
SebnemEr Oct 2, 2020
d18dd5f
Create fontawesome-webfont.ttf
SebnemEr Oct 2, 2020
cf8c5d4
Create plugin-bookdown.css
SebnemEr Oct 2, 2020
a2a8e5a
Create plugin-clipboard.css
SebnemEr Oct 2, 2020
dcb39d4
Create plugin-fontsettings.css
SebnemEr Oct 2, 2020
47d8f3d
Create plugin-highlight.css
SebnemEr Oct 2, 2020
3d456dc
Create index.html
SebnemEr Oct 2, 2020
4c699fb
Create publications.html
SebnemEr Oct 2, 2020
41135db
fhfh
SebnemEr Oct 2, 2020
2ee92c2
n
SebnemEr Oct 2, 2020
71b16de
d
SebnemEr Oct 2, 2020
63743fc
Update index.html
SebnemEr Oct 3, 2020
7501f6f
g
SebnemEr May 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
66 changes: 66 additions & 0 deletions SNA/presentation/sna.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "Social Network Analysis"
author:
name: Sebnem Er
affiliation: University of Cape Town | Statistical Sciences Department
# email: sebnem.er@uct.ac.za
date: Lecture 1 #"`r format(Sys.time(), '%d %B %Y')`"
output:
html_document:
theme: flatly
highlight: haddock
# code_folding: show
toc: yes
toc_depth: 4
toc_float: yes
keep_md: true
---

title: "R Notebook"
output: html_notebook

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, cache = TRUE, dpi=300)
```

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*.

```{r}
plot(cars)
```

Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

## Requirements

### External libraries (requirements vary by OS)

We're going to be doing all our spatial analysis and plotting today in R. Behind the scenes, R provides bindings to powerful open-source GIS libraries. These include the [Geospatial Data Abstraction Library (GDAL)](http://www.gdal.org/) and [Interface to Geometry Engine Open Source (GEOS)](https://trac.osgeo.org/geos/) API suite, as well as access to projection and transformation operations from the [PROJ.4 library](https://proj4.org/about.html). You needn't worry about all this, but for the fact that you *may* need to install some of these external libraries first. The requirements vary by OS:

- **Linux:** Requirements vary by distribution. See [here](https://github.com/r-spatial/sf#linux).
- **Mac:** You should be fine to proceed directly to the R packages installation below. An unlikely exception is if you've configured R to install packages from source; in which case see [here](https://github.com/r-spatial/sf#macos).
- **Windows:** Same as Mac, you should be good to go unless you're installing from source. In which case, see [here](https://github.com/r-spatial/sf#windows).

### R packages

- **New:** `sf`, `lwgeom`, `maps`, `mapdata`, `spData`, `tigris`, `tidycensus`, `leaflet`, `tmap`, `tmaptools`
- **Already used:** `tidyverse`, `hrbrthemes`

Note that you'll need `ggplot2` version 3.0.0 or above for the required [plotting support](https://www.tidyverse.org/articles/2018/07/ggplot2-3-0-0/) of `sf` objects. That's almost certainly the case, but now is a good time to upgrade you existing packages if you haven't done that for a while.

Okay, let's install (if necessary) and load everything. As per usual, I'll also set my preferred plotting theme, but this is unnecessary.

```{r, cache=F, message=F}
if (!require("pacman")) install.packages("pacman")
pacman::p_load(sf, tidyverse, hrbrthemes, lwgeom, rnaturalearth, maps, mapdata, spData, tigris, tidycensus, leaflet, tmap, tmaptools)
theme_set(hrbrthemes::theme_ipsum())
```


### Census API key
Binary file added SNA/snapresentation-figure/unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SNA/snapresentation-figure/unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions SNA/snapresentation.Rpres
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<style>
.reveal h1, .reveal h2, .reveal h3 {
word-wrap: normal;
-moz-hyphens: none;
}
.footer {
color: blue;
background: #E8E8E8;
position: fixed;
top: 90%;
text-align:center;
width:100%;
}
</style>

Social Network Analysis
========================================================
author: Sebnem Er
date:
autosize: true


Structure of the Workshop
========================================================
<ul>
<li>What is social network analysis?</li>
<ul>
<li>foundational concepts of social networks: graph theory</li>
</ul>
<li>Types of social network analysis.</li>
<ul>
<li>visualization of social networks,</li>
<li>descriptive analysis of social networks,</li>
<li>statistical network models.</li>
</ul>
<li>Network data: collection and applications in South Africa.</li>
<li>Packages.</li>
</ul>

-

Simple example - Edge list with no information
========================================================

```{r}
library(igraph)
# example in data frame
a=c("A","A","A","A","A","E","F")
b=c("B","C","D","E","F","F","G")
df = cbind(a,b)
df = as.data.frame(df)
df
```

Slide With Plot
========================================================

```{r, echo=FALSE}
g = graph.edgelist(as.matrix(df),directed = FALSE)
get.adjacency(g)
```

Slide With Plot
========================================================

```{r, echo=FALSE}
plot(g)
```
943 changes: 943 additions & 0 deletions SNA/snapresentation.html

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions SNA/snapresentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<style>
.reveal h1, .reveal h2, .reveal h3 {
word-wrap: normal;
-moz-hyphens: none;
}
.footer {
color: blue;
background: #E8E8E8;
position: fixed;
top: 90%;
text-align:center;
width:100%;
}
</style>

Social Network Analysis
========================================================
author: Sebnem Er
date:
autosize: true


Structure of the Workshop
========================================================
<ul>
<li>What is social network analysis?</li>
<ul>
<li>foundational concepts of social networks: graph theory</li>
</ul>
<li>Types of social network analysis.</li>
<ul>
<li>visualization of social networks,</li>
<li>descriptive analysis of social networks,</li>
<li>statistical network models.</li>
</ul>
<li>Network data: collection and applications in South Africa.</li>
<li>Packages.</li>
</ul>

-

Simple example - Edge list with no information
========================================================


```r
library(igraph)
# example in data frame
a=c("A","A","A","A","A","E","F")
b=c("B","C","D","E","F","F","G")
df = cbind(a,b)
df = as.data.frame(df)
df
```

```
a b
1 A B
2 A C
3 A D
4 A E
5 A F
6 E F
7 F G
```

Slide With Plot
========================================================


```
7 x 7 sparse Matrix of class "dgCMatrix"
A B C D E F G
A . 1 1 1 1 1 .
B 1 . . . . . .
C 1 . . . . . .
D 1 . . . . . .
E 1 . . . . 1 .
F 1 . . . 1 . 1
G . . . . . 1 .
```

Slide With Plot
========================================================

![plot of chunk unnamed-chunk-3](snapresentation-figure/unnamed-chunk-3-1.png)
37 changes: 37 additions & 0 deletions css/all.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* I am just copying the CSS file used by the lecturer Charlie Daly http://polya.computing.dcu.ie/ca165/css/ca165.css */

BODY {
font-family: Georgia, "Times New Roman", times, serif;
background-color: white;
color: #115;
text-align:justify;
text-indent:0%;
margin-left: 2.5%;
margin-right: 2.5%
}

TT { font-family: "Courier new", "courier"; font-weight: bold; /*font-size: 1.1 em;*/ color: black;}
SPAN.gloss { background-color: #fff; color: #1d1; } /* Background to make glossary item stand out */

/* ul { list-style-image: url(http://www.foo.com/bullet.gif) } A graphic for list items! */

LI { line-height: 1.3} /* Normal links are just far too close. */

td, th { empty-cells: show }

A:link { text-decoration:none; }
A:visited { text-decoration:none; }
A:active { text-decoration:none; }
A:hover { text-decoration:none; background-color:#eee;}

/* The following taken from
http://www.blooberry.com/indexdot/css/properties/generate/quotes.htm
*/
blockquote[lang-=fr] { quotes: "\201C" "\201D" }
blockquote[lang-=en] { quotes: "\00AB" "\00BB" }
blockquote:before { content: open-quote }
blockquote:after { content: close-quote }
blockquote { background:#dde;
font-style:italic;
padding-left:10pt; padding-right:10pt;
}
1 change: 1 addition & 0 deletions cv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added english/EUmembersCandidatesOthers19982008.dta
Binary file not shown.
Loading