Open stewid opened 10 years ago
Do you want the vignette in sweave or knitr?
@karthik what do you think is the best strategy?
Sorry, meant to reply earlier. I think we should go with knitr and not sweave. I'll add an example shortly.
@sckott I think your git2r_post (https://gist.github.com/sckott/10473818) is a great example to have in the vignette. Is that ok?
Sounds good, And the code was originally from you - i just added the figure :) It's updated with the Sara Varela gsub
.
The figure makes the difference :)
Nice, we should definitely include it as a use case! @stewid Just getting my head back above water. No more deadlines in the near future. Dives back into code. Crosses fingers
I sketched on some code to create a punch card graph
library(git2r)
library(ggplot2)
## repo <- repository("path/to/git2r")
## Extract information from repository
df <- as(repo, "data.frame")
df$when <- as.POSIXlt(df$when)
df$hour <- df$when$hour
df$weekday <- df$when$wday
## Create an index and tabulate
df$index <- paste0(df$weekday, "-", df$hour)
df <- as.data.frame(table(df$index), stringsAsFactors=FALSE)
names(df) <- c("index", "Commits")
## Convert index to weekday and hour
df$Weekday <- sapply(strsplit(df$index, "-"), "[", 1)
df$Weekday <- factor(df$Weekday,
levels = c(6, 5, 4, 3, 2, 1, 0),
labels = c("Saturday", "Friday", "Thursday",
"Wednesday", "Tuesday", "Monday", "Sunday"))
df$Hour <- as.integer(sapply(strsplit(df$index, "-"), "[", 2))
ggplot(df, aes(x = Hour, y = Weekday, size = Commits)) +
geom_point() +
scale_x_continuous(breaks = 0:23, limits = c(0, 23)) +
scale_y_discrete(labels = levels(df$Weekday)) +
theme(axis.title.x = element_blank(),
axis.title.y = element_blank())
Looks great. I've started work on replicating the commit graph from the main profile page as well.
I'll post that this weekend once I get it working correctly.
Your punch card looks slick!
We can extract the repo name too and add to the title.
Thanks. Great idea with title. Should we include it as a method punch_card
?
looks great
Added method punch_card
to package.
Hey, I just wanted to state, that I was surprised to find this package without any vignette on CRAN - I suggest simply re-using the current README on Github as a simple introduction vignette.
Add vignette with examples and use cases