1. Preprocessing.R 765 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

#importing following packages
library(tidyverse)
library(lubridate)
library(dplyr)
library(ggplot2)
library(leaflet)

#Packages can be installed using the code below:
#install.packages('leaflet')

#importing data file 'crime.csv'
df <- read.csv(file = "crime.csv", header = TRUE, sep=",")
#view first few rows
head(df)

#view number of rows and columns
dim(df)

#view data types
str(df)

#Preprocessing
df$YEAR <- as.factor(df$YEAR)
df$HOUR <- as.factor(df$HOUR)
df$MONTH <- as.factor(df$MONTH)
df$OCCURRED_ON_DATE <- as.POSIXct(df$OCCURRED_ON_DATE, format = "%Y-%m-%d %H:%M:%OS")

str(df)






#Shiny App

#importing shiny library
library(shiny)


ui <- basicPage("My first Shiny App")

server <- function(input, output){}

shinyApp(ui = ui, server = server)