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

Pitch plots #85

Closed prowe8 closed 2 years ago

prowe8 commented 2 years ago

Hi guys, wondered if someone could help me with the pitch plots. Followed all the instructions but guessing this 'NULL' message when I run it.

plot <- plot_shot(data, type = "density")

plot NULL

Think its something to do with the getting the data part (5 step code on the Tableau link) but not sure what to do differently. It said put in your desired export location but wasn't sure what that meant or what this bit meant (write.csv(data1,"OzilShot.csv", row.names = FALSE). When I put both into R nothing happens so not sure if its meant to haha

Cheers

harshkrishna17 commented 2 years ago

Hey! So what you can do is use the understatr package to scrape the data. For Ozil's shots, you can run the following code:

remotes::install_github('ewenme/understatr') #install the package

library(understatr)

data <- get_player_shots(499)

There's not much more to it, You dont need to save it as a .csv file or anything, simply scraping the data is enough and you can input the data into the plot_shot() function.

prowe8 commented 1 year ago

Thank you!

On Sun, 26 Jun 2022 at 16:56, Harsh Krishna @.***> wrote:

Hey! So what you can do is use the understatr package to scrape the data. For Ozil's shots, you can run the following code:

remotes::install_github('ewenme/understatr') #install the package

library(understatr) data <- get_player_shots(499)

There's not much more to it, You dont need to save it as a .csv file or anything, simply scraping the data is enough and you can input the data into the plot_shot() function.

— Reply to this email directly, view it on GitHub https://github.com/abhiamishra/ggshakeR/issues/85#issuecomment-1166571752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXR7OEWMQUTFKDQB2YJWXFLVRB4UVANCNFSM5Z37LEIA . You are receiving this because you authored the thread.Message ID: @.***>