Tagged "R"

Formatting Currencies in R

Here are a few different ways to format numbers in R. A few of theme can be accomplished using the paste function in R. I’ve found that there are a few different methods to do this. Using the scales package Using the scales packages from Hadley, there is a great function with various options including passing a vector. library(scales) dollar_format()(c(-100, 0.23, 1.456565, 2e3)) ## [1] "-$100.00" "$0.23" "$1.46" "$2,000.

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.

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) ## Warning: package 'tibble' was built under R version 3.6.2 ## Warning: package 'purrr' was built under R version 3.

Variable Importance in R

In progress

AB Testing in R from Scratch

Using Bayesian Systems Quantify the probability of all possibilites thus measuring risk insert institutional knowledge (add knowledge that changes the probability) learn in an online fashion A/B Testing with Approximate Bayesian Computation No mathematics required able to implement from scratch A/B Testing Measures and figures out the better design Approximate Bayesian Computation Generate a trial value for the thing we want to know (in this case its the conversion fraction of a layout) Simulate or data assuming the trail value, keep the trial value, otherwise discard it and try again If the simulation looks like the real data, keep the trial value, otherwise discard and try again Keep doing this until we’ve got lots of trial values that worked library(progress) library(ggplot2) library(reshape2) ## Warning: package 'reshape2' was built under R version 3.

Installing RStudio Server on Google Cloud

#In progress Still in progress

Tips on Creating Effective and Functional Documentation in R

Just like any skill, there is a learning curve involved in creating effective communication. This involves the code written and the documentation of its usage. Writing functional code is a intricate thing to accomplish as a newbie. It takes time to know what is efficient and how to communicate it as such. Now, writing functional documentation is more complicated as there is a delicate balance between not reguritate what the code says, and giving usable pointers to the users on how a particular function was intended to be used.

Tracking Change Improvements in Retail

In the ever changing world of retail; one always has to keep one step ahead of the competition and to engage with its customers. One of the best ways Formulate a test Implement Test Evaluate results Adjust the test Try again. These are all great ideas, but how do we truly watch tas things get better? library(qcc) ## Package 'qcc' version 2.7 ## Type 'citation("qcc")' for citing this R package in publications.