This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #In R 3.6, run: | |
| .libPaths()[1] | |
| #Copy this directory path and paste it on the line below; | |
| #Then run all lines below in R 4.0: | |
| PASTED <- "C:/Users/.../R/win-library/3.6" | |
| currentPackages <- list.dirs(path = PASTED , recursive = FALSE) | |
| currentPackages | |
| trimmed <- stringr::str_replace_all(currentPackages, paste(PASTED , "/", sep = ""), "") | |
| toInstall <- dput(trimmed) | |
| doInstall <- TRUE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| install.packages("tidyr", dependencies = TRUE) | |
| install.packages("ggplot2", dependencies = TRUE) | |
| install.packages("survey", dependencies = TRUE) | |
| install.packages("gridExtra", dependencies = TRUE) | |
| install.packages("dplyr", dependencies = TRUE) | |
| install.packages("stringr", dependencies = TRUE) | |
| install.packages("tidytext", dependencies = TRUE) | |
| install.packages("mvtnorm", dependencies = TRUE) | |
| install.packages("foreign", dependencies = TRUE) | |
| install.packages("Zelig", dependencies = TRUE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| theme_set(theme_bw()) | |
| Turkey <- read.csv("http://pages.iu.edu/~cdesante/turkey.csv") | |
| ggplot(data = Turkey) + geom_tile(aes(x = Happy, y = Thanksgiving, fill=Turkey.Colors | |
| )) + scale_fill_identity() + theme_bw() + labs(title = "Happy Thanksgiving 2016 from is.R()!\n", | |
| x = "", y = "") + scale_x_continuous(breaks = NULL)+ scale_y_continuous(breaks = NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| My.Words <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/Randwords.csv") | |
| My.Words$RANDOM.WORDS <- as.character(My.Words$RANDOM.WORDS) | |
| #Step 1: Split Character Vectors into Sub-strings: | |
| strsplit(My.Words$RANDOM.WORDS, "") | |
| Split.List <- strsplit(My.Words$RANDOM.WORDS, "") | |
| #Step 2: Assign a numeric value to each of the 26 letters: | |
| LETTERS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| doInstall <- TRUE | |
| toInstall <- c("maps", "ggplot2") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| library(ggplot2) | |
| library(maps) | |
| Prison <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/prison.csv") | |
| head(Prison) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| doInstall <- TRUE | |
| toInstall <- c("apsrtable") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| #http://cran.r-project.org/web/packages/apsrtable/apsrtable.pdf | |
| library(apsrtable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| doInstall <- TRUE | |
| toInstall <- c("apsrtable") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| #http://cran.r-project.org/web/packages/apsrtable/apsrtable.pdf | |
| library(apsrtable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| doInstall <- TRUE | |
| toInstall <- c("foreign") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| #http://cran.r-project.org/web/packages/foreign/foreign.pdf | |
| #setwd("your working directory here") | |
| library(foreign) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| toInstall <- c("ggplot2") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| library(ggplot2) | |
| Turkey <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/turkey.csv") | |
| ggplot(data = Turkey) + geom_tile(aes(x = Happy, y = Thanksgiving, fill=Turkey.Colors, | |
| width=1))+ scale_fill_identity() + theme_bw() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hjustvjust <- expand.grid( | |
| hjust=c(0, 0.5, 1), | |
| vjust=c(0, 0.5, 1), | |
| angle=c(0, 45, 90), | |
| text="is-R" | |
| ) | |
| hv <- ggplot(hjustvjust, aes(x=hjust, y=vjust)) + | |
| geom_point() + |
NewerOlder