buildingwidgets icon indicating copy to clipboard operation
buildingwidgets copied to clipboard

shooting signatures from Peter Beshai

Open timelyportfolio opened this issue 10 years ago • 8 comments

These could be used for lots of purposes outside of basketball https://gist.github.com/pbeshai/ffd0f9d84b4e8df27db2

timelyportfolio avatar Jan 09 '15 20:01 timelyportfolio

+1 for this one. After September, I could try to help if you'd like

kferris10 avatar Aug 25 '15 02:08 kferris10

these are super cool, and so nice looking

Cat1796 avatar Oct 15 '15 21:10 Cat1796

@kferris10 and @Cat1796 I have sort of held off on these, since I didn't want to just copy the author's work for basketball. I'd love some help thinking of non-basketball use cases and then I could get much more motivated to write a htmlwidget wrapper.

timelyportfolio avatar Oct 22 '15 21:10 timelyportfolio

I imagine that sort of spatial or temporal data would work well. I'll try to think of a couple of ideas outside of sports today.

kferris10 avatar Oct 26 '15 12:10 kferris10

So this is a really dorky example with some data I found by googling "repeated measures data." Here's a description of the data that I didn't understand.


library(dplyr)
library(ggplot2)

x <- read.table("http://www.stat.ufl.edu/~winner/data/ecophys_rc.dat") %>% 
  setNames(c("location", "treatment", "plant_id", "co2_concentration", "co2_uptake_rate")) %>% 
  group_by(plant_id) %>% 
  mutate(time = 1:n()) %>% 
  ungroup()
x
Source: local data frame [84 x 6]

   location treatment plant_id co2_concentration co2_uptake_rate time
1         1         1        1                95            16.0    1
2         1         1        1               175            30.4    2
3         1         1        1               250            34.8    3
4         1         1        1               350            37.2    4
5         1         1        1               500            35.3    5
6         1         1        1               675            39.2    6
7         1         1        1              1000            39.7    7
8         1         1        2                95            13.6    1
9         1         1        2               175            27.3    2
10        1         1        2               250            37.1    3
..      ...       ...      ...               ...             ...  ...

Then what I think would be cool would be shooting signatures like this plot. If we ignore the fact that this doesn't look very nice and that I cheated by using CO2 concentration twice, what I think would be cool would be something with a little reactivity. I think that it would be possible to make the signature, then have something like a shiny input to toggle the selected plant ID.

x %>% 
  filter(plant_id == 1) %>% 
  qplot(time, co2_uptake_rate, data = ., geom = "line", group = plant_id, 
      colour = co2_concentration, size = co2_concentration)

image

At work, I often want to make a plot like this for 10 or 20 different people. As far as I'm aware, the easiest way to do this is through a Shiny app. But even that's kind of a pain and it's difficult to share with people if you don't want to post stuff online. This would be a nice solution. Even in the basketball example it would be great to just click a box and change the shooter.

Anyways, hope this makes some sense. And sorry I wrote a novel. I can put together some more examples if you're interested.

kferris10 avatar Oct 26 '15 19:10 kferris10

This is great. Thanks so much for the effort. I'm sold. I won't be able to work on it until next week, but would think could get it up and running in a very short amount of time.

timelyportfolio avatar Oct 26 '15 19:10 timelyportfolio

Forgot to reply, but that sounds great. If you need some ideas for examples, let me know. I'm sure that I can find something.

kferris10 avatar Nov 09 '15 21:11 kferris10

I started working on this at https://github.com/timelyportfolio/shotsignR. By the end of the day, I hope it will be flexible enough to recreate your example.

timelyportfolio avatar Nov 12 '15 15:11 timelyportfolio