Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -205,7 +205,7 @@ calculate_primary <- function(data){
|
|
| 205 |
}
|
| 206 |
|
| 207 |
calculate_timstuff <- function(game) {
|
| 208 |
-
|
| 209 |
game <- game %>%
|
| 210 |
mutate(VAA = calculate_VAA(vz0, ay, az, vy0, y0),
|
| 211 |
EAA = calculate_EAA(extension),
|
|
@@ -217,7 +217,7 @@ calculate_timstuff <- function(game) {
|
|
| 217 |
ishandL = ifelse(phand == "L",1,0))
|
| 218 |
# game <- calculate_primary(game)
|
| 219 |
|
| 220 |
-
feature_vars <- c("ishandL","start_speed", "IVB", "HB", "EAA", "x0", "z0", "spin_rate","SADiff"
|
| 221 |
complete_rows <- complete.cases(game[, feature_vars])
|
| 222 |
game_complete <- game[complete_rows, ]
|
| 223 |
game_na <- game[!complete_rows,]
|
|
@@ -229,7 +229,7 @@ calculate_timstuff <- function(game) {
|
|
| 229 |
#
|
| 230 |
# lhp$TimStuff <- scale_TimStuff(predict(model, as.matrix(cbind(lhp$ishandL,lhp$start_speed, lhp$IVB, lhp$HB, lhp$EAA, lhp$x0, lhp$z0, lhp$spin_rate, lhp$SADiff,lhp$primary_speed,lhp$primary_IVB,lhp$primary_HB))), -0.00249975, 0.007566558)
|
| 231 |
|
| 232 |
-
rhp$TimStuff <- scale_TimStuff(predict(model, as.matrix(cbind(rhp$ishandL,rhp$start_speed, rhp$IVB, rhp$HB, rhp$EAA, rhp$x0, rhp$z0, rhp$spin_rate, rhp$SADiff
|
| 233 |
|
| 234 |
game_complete <- rbind(rhp,game_na)
|
| 235 |
return(game_complete)
|
|
|
|
| 205 |
}
|
| 206 |
|
| 207 |
calculate_timstuff <- function(game) {
|
| 208 |
+
# game <- calculate_primary(game)
|
| 209 |
game <- game %>%
|
| 210 |
mutate(VAA = calculate_VAA(vz0, ay, az, vy0, y0),
|
| 211 |
EAA = calculate_EAA(extension),
|
|
|
|
| 217 |
ishandL = ifelse(phand == "L",1,0))
|
| 218 |
# game <- calculate_primary(game)
|
| 219 |
|
| 220 |
+
feature_vars <- c("ishandL","start_speed", "IVB", "HB", "EAA", "x0", "z0", "spin_rate","SADiff")
|
| 221 |
complete_rows <- complete.cases(game[, feature_vars])
|
| 222 |
game_complete <- game[complete_rows, ]
|
| 223 |
game_na <- game[!complete_rows,]
|
|
|
|
| 229 |
#
|
| 230 |
# lhp$TimStuff <- scale_TimStuff(predict(model, as.matrix(cbind(lhp$ishandL,lhp$start_speed, lhp$IVB, lhp$HB, lhp$EAA, lhp$x0, lhp$z0, lhp$spin_rate, lhp$SADiff,lhp$primary_speed,lhp$primary_IVB,lhp$primary_HB))), -0.00249975, 0.007566558)
|
| 231 |
|
| 232 |
+
rhp$TimStuff <- scale_TimStuff(predict(model, as.matrix(cbind(rhp$ishandL,rhp$start_speed, rhp$IVB, rhp$HB, rhp$EAA, rhp$x0, rhp$z0, rhp$spin_rate, rhp$SADiff))), -0.002549184, 0.006202895)
|
| 233 |
|
| 234 |
game_complete <- rbind(rhp,game_na)
|
| 235 |
return(game_complete)
|