abhiamishra / ggshakeR

An analysis and visualization R package that works with publicly available soccer data
https://abhiamishra.github.io/ggshakeR/
MIT License
113 stars 14 forks source link

[Bug]: Error in `arrange()`: In argument: `..1 = stat`. Caused by error: #> ! `..1` must be a vector, not a function, appearing when using plot_pizza "custom" comparison. #123

Closed PaulinoVictor closed 1 year ago

PaulinoVictor commented 1 year ago

What happened?


ggshakeR version: 0.2.090 R version: 2023.08.0 - daily-170

I tried to make a custom comparison graph but it was not possible due to an error, i have followed every step in the tutorial but i could not figure it out.

is there any fix to it? is it the code or the function is not working properly?

i am using the daily build of r to avoid the CacheKey error present in the 2023.06 build.

library(worldfootballR) library(ggshakeR) library(reprex)

> Warning: package 'reprex' was built under R version 4.2.3

library(worldfootballR) library(ggshakeR)

data1 <-fb_player_scouting_report("https://fbref.com/en/players/65159211/Yuri-Alberto", pos_versus = "primary")

data2 <- fb_player_scouting_report("https://fbref.com/en/players/2e5e846d/Deyverson", pos_versus = "primary")

data1 <- data1[c(345,338,301,377,394,386,387,402,393,395), ]

data2 <- data2[c(210,203,166,242,259,251,252,267,258,260), ]

data <- rbind(data1, data2)

graph <- plot_pizza(data = data, type = "comparison", template = "custom", player_1 = "Deyverson", player_2 = "Yuri Alberto", season_player_1 = "2023 Série A", season_player_2 = "2023 Série A", color_compare = "#c1ef01", theme = "black")

> Error in arrange():

> ℹ In argument: ..1 = stat.

> Caused by error:

> ! ..1 must be a vector, not a function.

> Backtrace:

> ▆

> 1. ├─ggshakeR::plot_pizza(...)

> 2. │ └─data1 %>% arrange(desc(stat), desc(Percentile)) %>% ...

> 3. ├─dplyr::mutate(., Statistic = factor(Statistic, levels = Statistic))

> 4. ├─dplyr::arrange(., desc(stat), desc(Percentile))

> 5. ├─dplyr:::arrange.data.frame(., desc(stat), desc(Percentile))

> 6. │ └─dplyr:::arrange_rows(.data, dots = dots, locale = .locale)

> 7. │ ├─dplyr::mutate(data, :=("{name}", !!dot), .keep = "none")

> 8. │ └─dplyr:::mutate.data.frame(data, :=("{name}", !!dot), .keep = "none")

> 9. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)

> 10. │ ├─base::withCallingHandlers(...)

> 11. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)

> 12. │ └─mask$eval_all_mutate(quo)

> 13. │ └─dplyr (local) eval()

> 14. ├─dplyr:::dplyr_internal_error("dplyr:::mutate_not_vector", <named list>)

> 15. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)

> 16. │ └─rlang:::signal_abort(cnd, .file)

> 17. │ └─base::signalCondition(cnd)

> 18. └─dplyr (local) <fn>(<dpl:::__>)

> 19. └─rlang::abort(message, class = error_class, parent = parent, call = error_call)

graph

> Error in eval(expr, envir, enclos): objeto 'graph' não encontrado

ggsave("comparacao.png", bg = "black", width = 2900, height = 2800, units = "px")

> Error in ggsave("comparacao.png", bg = "black", width = 2900, height = 2800, : não foi possível encontrar a função "ggsave"

abhiamishra commented 1 year ago

Hello Victor,

The package has a bug in it that needs to be fixed however all maintainers of the package are busy 😅. I will try to get this ASAP (I’ve had others send me similar emails) but bare with me as I’m the only active maintainer :)

Thank you,

Abhishek

On Mon, Jul 3, 2023 at 4:24 PM Victor Paulino @.***> wrote:

What happened?

ggshakeR version: 0.2.090 R version: 2023.08.0 - daily-170

I tried to make a comparison graph but it was not possible due to the Error in ans[ypos] <- rep(yes, length.out = len)[ypos], so i repeated the same code used as a example in the tutorial page but it was still appearing and not generating any graph.

is there any fix to it? is it the code or the function is not working properly?

i am using the daily build of r to avoid the CacheKey error present in the 2023.06 build.

library(worldfootballR) library(ggshakeR) library(reprex)

> Warning: package 'reprex' was built under R version 4.2.3

data1 <- fb_player_scouting_report(" https://fbref.com/en/players/f586779e/Tammy-Abraham", pos_versus = "primary") data2 <- fb_player_scouting_report(" https://fbref.com/en/players/59e6e5bf/Dominic-Calvert-Lewin", pos_versus = "primary")

data <- rbind(data1, data2)

comp_pizza <- plot_pizza(data = data, type = "comparison", template = "outfielder", player_1 = "Tammy Abraham", player_2 = "Dominic Calvert-Lewin", season_player_1 = "Last 365 Days", season_player_2 = "Last 365 Days", color_compare = "#41ab5d", theme = "black") comp_pizza

> Warning in rep(yes, length.out = len): 'x' is NULL so the result will

be NULL

> Error in ans[ypos] <- rep(yes, length.out = len)[ypos]: substituto tem

comprimento zero

— Reply to this email directly, view it on GitHub https://github.com/abhiamishra/ggshakeR/issues/123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMZTJDCUSUM3SSRSCQA5ADXOMZ7JANCNFSM6AAAAAAZ45GGBM . You are receiving this because you are subscribed to this thread.Message ID: @.***>