LEEP<- read.csv("C:/Users/u6032404/OneDrive/backup 9.9.19/MJ/LEEP/LEEP.csv",header = T)
newLEEP <- LEEP[-c(2,1), ] 
vis_miss(newLEEP, cluster = TRUE)

prop_miss(newLEEP)
## [1] 0
prop_complete(newLEEP)
## [1] 1
miss_var_summary(newLEEP)
## # A tibble: 228 x 3
##    variable              n_miss pct_miss
##    <chr>                  <int>    <dbl>
##  1 StartDate                  0        0
##  2 EndDate                    0        0
##  3 Status                     0        0
##  4 IPAddress                  0        0
##  5 Progress                   0        0
##  6 Duration..in.seconds.      0        0
##  7 Finished                   0        0
##  8 RecordedDate               0        0
##  9 ResponseId                 0        0
## 10 RecipientLastName          0        0
## # ... with 218 more rows
newLEEP$Duration..in.seconds.<-as.numeric(newLEEP$Duration..in.seconds.)
newLEEP$Minute <- newLEEP$Duration..in.seconds. %/% 60
summary(newLEEP$Minute)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    5.00    9.00   12.50   18.69   18.00  733.00
newLEEP %>%
  filter(Minute < 120) %>%
  ggplot(aes(x = Minute)) +
  geom_histogram(bins = 30)+theme_minimal()+xlab("Minute") + ylab("Count")+ggtitle("Completion Duration (LEEP) ")

newLEEP$LocationLatitude<-as.numeric(newLEEP$LocationLatitude) 
newLEEP$LocationLongitude<-as.numeric(newLEEP$LocationLongitude)
usa1 <- map_data("world") %>% filter(region=="USA")
data <- world.cities %>% filter(country.etc=="USA")

ggplot() +
  geom_polygon(data = usa1, aes(x=long, y = lat, group = group), fill="blue",size=40,alpha=4)+geom_point(data = newLEEP, aes(x = LocationLongitude, y = LocationLatitude), col = "red", shape = 16, alpha = 1, size=1) +  theme_void() + coord_map() +ggtitle("The Location of Participants in the LEEP Study")+ylim(25,50)+xlim(-150,-50)

ggsave("x1.png", width = 20, height = 20)