Skip to content

Commit

Permalink
quote
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBorst committed Sep 27, 2020
1 parent 2f4406f commit be6d708
Show file tree
Hide file tree
Showing 7 changed files with 4,773 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CurrentBI/GreenfieldQuotes.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ library(tidymodels)
library(stringr)
library(lubridate)
library(skimr)
library(tidyverse)

gp <- read_csv("C:/Users/aborst/R-Scripts/PrivateData/GF_Quotes2020.csv")
gp <- read_csv("C:/Users/aborst/R-Projects/PrivateData/GF_Quotes2020.csv")
gp <- read_csv("C:/Users/My Surface/Documents/R-Projects/PrivateData/GF_Quotes2020.csv")

source(file = "Data_Access/database_functions.R")

Expand Down Expand Up @@ -74,7 +76,7 @@ gp_submitted <- gp %>%
mutate(status = "Submitted")


gpplot <- union_all(gp2, gp_submitted)
gp_plot <- union_all(gp2, gp_submitted)

ggplot(data = gpplot, aes(weekNo, orderTotal, fill=status)) +
geom_bar(stat="identity", position ="dodge") +
Expand Down
49 changes: 49 additions & 0 deletions DS4B_101_R_Business_Analysis/test/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

# Application title
titlePanel("Old Faithful Geyser Data"),

# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),

# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)

# Define server logic required to draw a histogram
server <- function(input, output) {

output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)

# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}

# Run the application
shinyApp(ui = ui, server = server)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: test
title: test
username:
account: andrew-borst
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 2551287
bundleId: 3369851
url: https://andrew-borst.shinyapps.io/test/
when: 1594259918.76245
asMultiple: FALSE
asStatic: FALSE
7 changes: 7 additions & 0 deletions DS4B_102_R_Shiny_Apps_1/00_scripts/01_install_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ r_pkgs <- c(
)

install.packages(r_pkgs)

r_pkgs <- c(
"tidymodels",
"skimr"
)

install.packages(r_pkgs)
4,591 changes: 4,591 additions & 0 deletions DS4B_102_R_Shiny_Apps_1/03_sales_dashboard_shiny/02_sales_dashboard_shiny.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: shiny_tu
title: shiny_t
username:
account: andrew-borst
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 2551299
bundleId: 3369869
url: https://andrew-borst.shinyapps.io/shiny_tu/
when: 1594260364.53781
asMultiple: FALSE
asStatic: FALSE
98 changes: 98 additions & 0 deletions ExplorationAndModels/Pi.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
library(tidyverse)
#Defining URL to download csv (100k digits)
url<-"https://www.angio.net/pi/digits/100000.txt"
#reading file
d <- readr::read_file(url)
dlist = list()
j <- 0
for(i in 0:99999)
{
if(i>10000)
{
sc <- str_count(d, as.character(i))
if(sc > 5)
{
j <- j + 1
z <- cbind.data.frame(x = sc, y = i)
dlist[[j]] <- z
}
}

}

big_data = do.call(rbind, dlist)

#splitting string into single characters
data.vec<-strsplit(data.raw, "")


#vector to dataframe and
data.df1<-data.frame(data.vec[1])

#removing the "." i.e. 2nd row
data.df2<-data.frame(data.df1[-c(2),])

#renaming column to digits
names(data.df2)[1]<-"digits"

##Dividing the digits into x and y
#Adding a column of row number
data.df3<-data.df2%>%
mutate(id=seq(1:nrow(data.df2)))

#Adding a column of coordinate (x or y) and reshuffling the columns
data.df4<-data.df3%>%
mutate(cor=ifelse(id%%2==0,"y","x"))


#changing class of digits to integers. Earlier parsed as char

data.df4$digits<-as.integer(data.df4$digits)

#Creating data frame of x and y coordinates
x<-data.df4[c(T,F),1]
y<-data.df4[c(F,T),1]

data.cor<-data.frame(x,y)

head(data.cor)

#creating a column showing row position
data.cor$pos<-seq(1:nrow(data.cor))

#defining the size of each group
lot=1000

#Creating groups
data.plot<-data.cor%>%
mutate(grp=floor(pos/lot)+1)


#Creating vectors with coordinates of first dot of each group
minx=NULL
miny=NULL
for(i in 0:(49999)){
j=(floor(i/lot)*lot)+1
minx[i+1]<-data.plot$x[j]
miny[i+1]<-data.plot$y[j]
}

#creating columns from vector
data.plot$xend=minx
data.plot$yend=miny

#Removing rows containing coordinates of first point of each group

rowrmv<-c(which(data.plot$x==data.plot$xend & data.plot$y==data.plot$yend))

data.plotf<-data.plot[-rowrmv,]

#Plotting
art100k.1<-data.plotf%>%
ggplot()+
geom_curve(aes(x = x, y = y, xend = xend, yend = yend, colour = factor(x)),
curvature=0.2,alpha=0.2)+theme_void()+ scale_color_brewer(palette="Greys")+
theme(legend.position = "none",panel.background = element_rect(fill="#000000"))+
xlim(-1,10)+ylim(-1,10)

plot(art100k.1)

0 comments on commit be6d708

Please sign in to comment.