wpowerswpowers42.github.io/Recent content on wpowersHugo -- gohugo.ioen-usFri, 15 Apr 2022 00:00:00 -0500Redshift Trickswpowers42.github.io/2022/04/15/redshift-tricks/Fri, 15 Apr 2022 00:00:00 -0500wpowers42.github.io/2022/04/15/redshift-tricks/Split PascalCase string to individual words SELECT REGEXP_REPLACE('SmilingFaceWithOpenMouthAndColdSweat', '\\B([A-Z][^A-Z]*)', ' $1'); -- Smiling Face With Open Mouth And Cold Sweat Source: adopted for Redshift from this StackOverflow answerChart Types in Rwpowers42.github.io/2022/03/15/chart-types-in-r/Tue, 15 Mar 2022 01:46:14 -0500wpowers42.github.io/2022/03/15/chart-types-in-r/Histogram ggplot(data = faithful) + aes(x = waiting) + geom_histogram(binwidth = 5, color = 'white') + labs(x = 'Minutes Until Next Eruption', y = 'Number of Observations') Frequency Polygon faithful$size = ifelse(faithful$eruptions > 4, 'large', 'small') ggplot(data = faithful) + aes(x = waiting, color = size) + geom_freqpoly(binwidth = 5) + labs(x = 'Minutes Until Next Eruption', y = 'Number of Observations', color = 'Eruption Size') Box Plot https://en.wikipedia.org/wiki/Box_plot
faithful$size = ifelse(faithful$eruptions > 4, 'large', 'small') ggplot(data = faithful) + aes(x = size, y = waiting) + geom_errorbar(stat='boxplot', width = 0.Glass Stepping Stoneswpowers42.github.io/2022/02/19/glass-stepping-stones/Sat, 19 Feb 2022 00:00:00 +0000wpowers42.github.io/2022/02/19/glass-stepping-stones/Glass Stepping Stones is the fifth game in Squid Game. There are two parallel bridges made up of 18 glass panels each. There are two types of glass panels: regular glass that breaks when a player steps on it and tempered glass that won’t break.
There is a regular and tempered glass panel at each ‘step’ of the bridge. Contestants must choose a path across the bridge that avoids the regular glass panels (and their deaths).Randomness in Rwpowers42.github.io/2022/02/16/randomness-in-r/Wed, 16 Feb 2022 21:13:14 -0500wpowers42.github.io/2022/02/16/randomness-in-r/https://blog.revolutionanalytics.com/2009/02/how-to-choose-a-random-number-in-r.html
Generate random numbers between 0 and 1 runif(1,0,1) # 1 random number runif(5,0,1) # 5 random numbers Generate random integers between 1 and 100 sample(x = 100, size = 1, replace = TRUE) # x = 100 means between 1 and 100 sample(x = 100, size = 5, replace = TRUE) # 5 random numbers sample(x = 100, size = 5, replace = FALSE) # 5 random numbers, without replacement sample(x = 50:100, size = 5, replace = TRUE) # 5 random numbers between 50 and 100 Select random items from a list sample(x = state.Aboutwpowers42.github.io/about/Thu, 05 May 2016 21:48:51 -0700wpowers42.github.io/about/