Phillips Hue in R

The following function can be used to find and display the internal IP address needed to retrieve the IP address from Hue Bridge. You will need to generate an API key i.e. a “userkey” as I called it below. getIP <- function() { url <- paste0("https://www.meethue.com/api/nupnp") res <- httpGET(url) resJson <- fromJSON(res) res <- resJson[["internalipaddress"]] res } In order to know what light you should change the state on, one can run the following to retrieve the available lights connected on the network....

August 7, 2018 · 1 min · 204 words · Chris Ried

Simulate Doctor Visit Resource Planning Using Simmer

Here I’ve tried to come up with a simple layout on how we might simulate doctor’s visits. Following code tries to resource plan certain doctor visits based on the vignette that was provided with the simmer package. library(simmer) set.seed(42) env <- simmer("SuperDuperSim") env patient <- trajectory("patients' path") %>% ## add an intake activity seize("nurse", 1) %>% timeout(function() rnorm(1, 15)) %>% release("nurse", 1) %>% ## add a consultation activity seize("doctor", 1) %>% timeout(function() rnorm(1, 20)) %>% release("doctor", 1) %>% ## add a planning activity seize("administration", 1) %>% timeout(function() rnorm(1, 5)) %>% release("administration", 1) env %>% add_resource("nurse", 1) %>% add_resource("doctor", 2) %>% add_resource("administration", 1) %>% add_generator("patient", patient, function() rnorm(1, 10, 2)) env %>% run(80) %>% now() env %>% peek(3) env %>% stepn() %>% # 1 step print() %>% stepn(3) # 3 steps envs <- lapply(1:100, function(i) { simmer("SuperDuperSim") %>% add_resource("nurse", 1) %>% add_resource("doctor", 2) %>% add_resource("administration", 1) %>% add_generator("patient", patient, function() rnorm(1, 10, 2)) %>% run(80) }) envs %>% get_mon_resources() %>% head() envs %>% get_mon_arrivals() %>% head()

August 7, 2018 · 1 min · 165 words · Chris Ried

Take Back Your Time (Evernote)

You will find the following text originally posted on Medium

August 7, 2018 · 1 min · 10 words · Chris Ried

Time and Difficulty

Sometimes, seeing data in a 3 dimensional space gives us better visibility to the rest of the world. You will see that we have taken a hypothetical experiment and tried to rate different ideas by their complexity and likelihood to succeed. #Libraries to import library(tidyverse) library(plotly) # Intellectual matrix idea <- c("Build a spaceship","Create a new social platform", "Build a birdhouse","Collect 10000 friends", "Clip toenails","Build a spaceship","Create a new social platform", "Build a birdhouse","Collect 10000 friends","Build a spaceship","Create a new social platform", "Build a birdhouse","Collect 10000 friends","Build a spaceship","Create a new social platform", "Build a birdhouse","Collect 10000 friends") time <- c(5,5,2,3,1,5,5,2,3,5,5,2,3,1,5,5,2) difficulty <- c(5,4,2,3,1,5,4,2,3,5,5,2,3,1,5,5,2) favorability <- c(2,5,2,1,3,4,1,2,1,2,5,2,1,3,3,1,2) #Creates the dataframe dataset <- data....

August 7, 2018 · 1 min · 173 words · Chris Ried

Minature Generative Art

Sometimes something simple can turn out to generate the most beautiful things. Following you will find a few lines of code that present a beautiful pattern. library(ggplot2) library(dplyr) Oval Curve n <- 300 t1 <- 1:n t0 <- seq(3,2*n+1,2) %% n t2 <- t0 + (t0 == 0)*n df <- data.frame(x = cos((t1-1)*2*pi/n), y = sin((t1-1)*2*pi/n), x2 = cos((t2-1)*2*pi/n), y2 = sin((t2-1)*2*pi/n)) ggplot(df,aes(x,y,xend = x2,yend = y2)) + geom_segment(alpha = ....

January 8, 2018 · 1 min · 94 words · CRied

Extracting Hyperlinks from an XSLX in R

In Progress install.packages("keras") library(keras) devtools::install_github("omarwagih/ggseqlogo") devtools::install_github("leonjessen/PepTools")

January 4, 2018 · 1 min · 6 words · CRied

Human Ingenuity and Speed

library(tidyverse) Data Building The first thing we need to understand is where we have come and where we are going. There is alot that has been done in the past couple years but we still have more. type <- c("Sound","Light","Human Travel") units <- c("mps","mps","mps") speed <- c(343,299792458,11082.569) source <- c("","","") speed_data <- data.frame(type,units, speed,source) spd <- speed_data$speed spd %*% (t(spd)) –TODO: The following 299792458/11082.57 Human History of Speed Speed hasn’t been a

December 23, 2017 · 1 min · 72 words · Chris

Words With Friends Musings

Words with Friends is a wonderful game full of #library(tidyverse) # IMport Data #filepath <- "~/Dropbox/Word Lists/WordsWithFriends/enable1-wwf-v4.0-wordlist.txt" #wwfList <- read_csv(filepath, col_names = FALSE) #wwfList %>% stringr::str('.ae.')

December 3, 2017 · 1 min · 26 words · Chris Ried

Exploring the Book of Esther in the Tidy Verse

library(httr) library(tidytext) library(jsonlite) library(tidyverse) library(wordcloud) library(XML) source("~/keys.R") key <- biblia There is much to be learned in the form of writing and the relationship it has within and outside the text. The question we might want to ask is there a way to identify the story arc of the situation. Using spacy to tag all of the words will increase the likelyhood to better understand the style <- "oneVersePerLineFullReference" #oneVersePerLine, bibleTextOnly, oneVersePerLineFullReference output <- "html" passage <-"Esther1-10" resp <- GET(paste0("https://api....

November 30, 2017 · 2 min · 342 words · C Ried

Timeseries Analysis Using R and Advantager

Threw error due to the API In the past, the best way to get stock prices was to use either Google Finance or Yahoo Finance data streams. These have since become difficult to keep up to date and thus another outlet to get this information is AlphaVantager. Following is a simple R implementation to get up to date data. You will be able to thus use this to find the information....

November 11, 2017 · 1 min · 183 words · C Ried