Posts

This is the letter I sent out to my data science organization about the news that came out of DataCamp this week. 4/6/2019 Dear DatASci, I write to ask you for your input in developing a group response to these recent events. Overnight on Thursday, April 4, DataCamp released a statement in their official blog that you can find here: https://www.datacamp.com/community/blog/note-to-our-community. To summarize, in October of 2017, an executive at the company sexually harassed an employee at a company social event.

CONTINUE READING

This is the letter I sent out to my data science organization about the news that came out of DataCamp this week. 4/6/2019 Dear DatASci, I write to ask you for your input in developing a group response to these recent events. Overnight on Thursday, April 4, DataCamp released a statement in their official blog that you can find here: https://www.datacamp.com/community/blog/note-to-our-community. To summarize, in October of 2017, an executive at the company sexually harassed an employee at a company social event.

CONTINUE READING

library("gganimate") library("ggplot2") p = 1/2 # parameters p <- 0.5 Tmax = 60 # start at the origin x = 0 y = 0 t = 0 df <- data.frame(x,y,t) # random walk for(i in 1:Tmax){ t <- t + 1 if(runif(1) < p){ x <- x - 1 } else { x <- x + 1 } # reset process if dot leaves view if(abs(x) > 10){ x <- 0 } this_step <- data.

CONTINUE READING

In this short project, I hope to draw a heart through an animation of appearing dots. library("gganimate") library("ggforce") library("tidyverse") Draw a Heart Here I will place two circles centered at \((\pm 1, 1)\) with the same radius \(r = \sqrt{2}\). circles <- data.frame( x0 = c(-1,1), y0 = rep(1,2), r = rep(1, 2) ) right_pt <- (sqrt(2) + 1) / sqrt(2) left_pt <- -1*right_pt f <- function(x){abs(x) - sqrt(2)} ggplot(data.frame(x = c(left_pt, right_pt)), aes(x)) + coord_fixed() + geom_circle(aes(x0 = x0, y0 = y0, r = r), data = circles, inherit.

CONTINUE READING

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: 'ggstance' ## The following objects are masked from 'package:ggplot2': ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

CONTINUE READING

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: 'ggstance' ## The following objects are masked from 'package:ggplot2': ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

CONTINUE READING

Today I wanted to see if I could create a slideshow of pictures from the gganatogram package. I wanted to combine them with the gganimate package, but I have not figured out how to get that to work. (In particular, the gganatogram() function seems to return a different list layout than ggplot objects.) library(gganatogram) ## Loading required package: ggpolypath ## Loading required package: ggplot2 library(gganimate) library(profvis) N <- 25 # number of cell samples num_cell_parts <- nrow(cell_key$cell) # randomly select a random number of cell parts part_picker <- sample(1:num_cell_parts, sample(1:num_cell_parts, 1)) cell_num <- rep(1, length(part_picker)) this_cell <- cell_key[['cell']][part_picker, ] cell_samples <- cbind(this_cell, cell_num) for(j in 2:N){ part_picker <- sample(1:num_cell_parts, sample(1:num_cell_parts, 1)) cell_num <- rep(j, length(part_picker)) this_cell <- cbind( cell_key[['cell']][part_picker, ], cell_num) cell_samples <- rbind(cell_samples, this_cell) # figure_list[j] <- gganatogram(data = this_cell, # outline = FALSE, fillOutline='steelblue', organism="cell", fill="colour") + # theme_void() + # coord_fixed() png(filename = paste0(j, ".

CONTINUE READING

Today, I hope to present a quick glimpse at the phenomenon called the “Curse of Dimensionality”. For this demonstration, I am simply calculating how much random data stays within two standard deviations (in the Euclidean norm) as we go from one dimension to higher dimensions. Random Data Here are 10 vectors of 100 random numbers each sampled from the standard normal distribution stored as a matrix … X <- matrix(rnorm(1000), nrow = 100, ncol = 10) … and as a data frame.

CONTINUE READING

In this post, I want to run an example of absorbing states in stochastic processes. This example is based on Example 3.29 in Introduction to Stochastic Processes in R by Robert Dobrow. Data The data I have assembled is based on IRDS reports from my own University of California at Merced. # weights weights <- c(20, 70, 0, 0, 10, 0, 0, 5, 89, 0, 6, 0, 0, 0, 3, 94, 3, 0, 0, 0, 0, 24, 1, 76, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 100) sparse_weights <- weights[weights > 0] # transition matrix (row stochastic) P <- matrix(weights, nrow = 6, byrow = TRUE)*0.

CONTINUE READING

Today I finally read a tutorial on gganimate, and here I will build my first example. My hope is to eventually simulate traversal on a directed graph. library(tidyverse) library(gganimate) Create Node Data For this example, I will have 3 nodes (located at 3 vertices of a triangle), 100 dots distributed among the nodes, and a new placement over 21 states in time. N <- 100 # number of dots T <- 20 # number of iterations node_names <- c("Node 1", "Node 2", "Node 3") iter <- rep(0, N) node <- rep("Node 1", N) x <- 10 + rnorm(N, 0, 2) y <- 20 + rnorm(N, 0, 2) states <- data.

CONTINUE READING