sna_eg_stanford:lab06
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sna_eg_stanford:lab06 [2019/12/03 06:18] – [Lab 06: Step 4 deleted] hkimscil | sna_eg_stanford:lab06 [2019/12/11 01:40] (current) – [no pdf] hkimscil | ||
|---|---|---|---|
| Line 39: | Line 39: | ||
| library(NetCluster) | library(NetCluster) | ||
| + | # install.packages(c(" | ||
| ### | ### | ||
| #2. LOADING AND FORMATTING DATA | #2. LOADING AND FORMATTING DATA | ||
| Line 55: | Line 56: | ||
| m182_friend <- delete_edges(m182_full, | m182_friend <- delete_edges(m182_full, | ||
| summary(m182_friend) | summary(m182_friend) | ||
| + | m182_friend[] | ||
| m182_social <- delete_edges(m182_full, | m182_social <- delete_edges(m182_full, | ||
| summary(m182_social) | summary(m182_social) | ||
| + | m182_social[] | ||
| m182_task <- delete_edges(m182_full, | m182_task <- delete_edges(m182_full, | ||
| summary(m182_task) | summary(m182_task) | ||
| + | m182_task[] | ||
| # Look at the plots for each sub-graph | # Look at the plots for each sub-graph | ||
| Line 992: | Line 996: | ||
| # Look at the plots for each sub-graph | # Look at the plots for each sub-graph | ||
| - | pdf(" | + | # pdf(" |
| par(mfrow = c(1,3)) | par(mfrow = c(1,3)) | ||
| Line 1003: | Line 1007: | ||
| task_layout <- layout.fruchterman.reingold(m182_task) | task_layout <- layout.fruchterman.reingold(m182_task) | ||
| plot(m182_task, | plot(m182_task, | ||
| - | dev.off() | + | # dev.off() |
| + | # back to normal window pannel (no partition) | ||
| + | par(mfrow = c(1,1)) | ||
| ### | ### | ||
| Line 1084: | Line 1091: | ||
| # the " | # the " | ||
| - | pdf(" | + | # pdf(" |
| m182_task_social_hclust <- hclust(m182_task_social_dist) | m182_task_social_hclust <- hclust(m182_task_social_dist) | ||
| plot(m182_task_social_hclust) | plot(m182_task_social_hclust) | ||
| - | dev.off() | + | # dev.off() |
| # cutree() allows us to use the output of hclust() to set | # cutree() allows us to use the output of hclust() to set | ||
| Line 1124: | Line 1131: | ||
| # with the observed correlation matrix. | # with the observed correlation matrix. | ||
| - | pdf(" | + | # pdf(" |
| clustered_observed_cors < | clustered_observed_cors < | ||
| clustered_observed_cors | clustered_observed_cors | ||
| plot(clustered_observed_cors$correlations) | plot(clustered_observed_cors$correlations) | ||
| - | dev.off() | + | # dev.off() |
| clustered_observed_cors$correlations | clustered_observed_cors$correlations | ||
| Line 1278: | Line 1285: | ||
| nS <- nScree(ev$values, | nS <- nScree(ev$values, | ||
| - | pdf(" | + | # pdf(" |
| plotnScree(nS) | plotnScree(nS) | ||
| Line 1285: | Line 1292: | ||
| plotnScree(nS) | plotnScree(nS) | ||
| abline(h=1) | abline(h=1) | ||
| - | dev.off() | + | # dev.off() |
| Line 1322: | Line 1329: | ||
| m182_task_factor_hclust <- hclust(m182_task_factor_dist) | m182_task_factor_hclust <- hclust(m182_task_factor_dist) | ||
| - | pdf(" | + | # pdf(" |
| plot(m182_task_factor_hclust) | plot(m182_task_factor_hclust) | ||
| - | dev.off() | + | # dev.off() |
| # And compare to NetCluster based on correlations and triads: | # And compare to NetCluster based on correlations and triads: | ||
| - | pdf(" | + | # pdf(" |
| - | par(mfrow = c(1,3)) | + | par(mfrow = c(1,2)) |
| plot(m182_task_social_hclust, | plot(m182_task_social_hclust, | ||
| plot(m182_task_factor_hclust, | plot(m182_task_factor_hclust, | ||
| - | plot(m182_task_triad_hclust, | + | # the below one that didn't work |
| - | dev.off() | + | # plot(m182_task_triad_hclust, |
| + | # dev.off() | ||
sna_eg_stanford/lab06.1575353882.txt.gz · Last modified: by hkimscil
