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(tidyverse) | |
| library(readxl) | |
| library(stringr) | |
| xl_data <- read_excel("Feedback_Job_Interview.xlsx") | |
| col_names <- c("student", "date", "preparation", "fluency", "grammar", "vocabulary", "questions", "grade", "comments") | |
| colnames(xl_data) <- col_names |
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
| # Based on this blog post: https://www.r-bloggers.com/updating-r/ | |
| ### 1 | |
| ## Change accordingly | |
| list_dir <- "/Library/Frameworks/R.framework/Resources/library" | |
| ## Get the list of installed packages | |
| installed <- dir(.libPaths()) | |
| ## Save the list for later use |
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
| construction <- as.Date("1961-08-13") | |
| fall <- as.Date("1989-11-09") | |
| now <- as.Date("2018-02-06") | |
| now-fall > fall-construction | |
| fall-construction | |
| now-fall |
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(RColorBrewer) | |
| qual_col_pals <- brewer.pal.info[brewer.pal.info$category == 'qual',] | |
| col_vector <- unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals))) | |
| #check | |
| myunif <- runif(40, 1, 1) | |
| barplot(myunif, col = col_vector) |
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
| # Finding square numbers that are also triangular numbers | |
| # This snippet of code has been inspired by Matt Parker's book: Things to make and do in the fourth dimension, Chapter 3, pg. 50 | |
| # Square numbers | |
| SqNum <- function(to, from = 1) { | |
| x <- NULL | |
| for(i in seq(from = from, to = to)) { | |
| x[i] <- i^2 | |
| } |
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
| ## -------------------------- ## | |
| ## An R Function that Shades ## | |
| ## under a normal density. ## | |
| ## ## | |
| ## This is a convenience ## | |
| ## function for polygon() ## | |
| ## -------------------------- ## | |
| shadenorm = function(below=NULL, above=NULL, pcts = c(0.025,0.975), mu=0, sig=1, numpts = 500, color = "gray", dens = 400, | |
| lines=FALSE,between=NULL,outside=NULL){ |
NewerOlder