Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vignette #19

Open
stewid opened this issue Mar 31, 2014 · 15 comments
Open

Add vignette #19

stewid opened this issue Mar 31, 2014 · 15 comments

Comments

@stewid
Copy link
Member

stewid commented Mar 31, 2014

Add vignette with examples and use cases

@trosendal
Copy link
Contributor

Do you want the vignette in sweave or knitr?

@stewid
Copy link
Member Author

stewid commented Apr 1, 2014

@karthik what do you think is the best strategy?

@karthik
Copy link
Member

karthik commented Apr 1, 2014

Sorry, meant to reply earlier. I think we should go with knitr and not sweave. I'll add an example shortly.

@stewid
Copy link
Member Author

stewid commented Apr 11, 2014

@sckott I think your git2r_post (https://gist.github.com/sckott/10473818) is a great example to have in the vignette. Is that ok?

@sckott
Copy link
Contributor

sckott commented Apr 11, 2014

Sounds good, And the code was originally from you - i just added the figure :) It's updated with the Sara Varela gsub.

@stewid
Copy link
Member Author

stewid commented Apr 11, 2014

The figure makes the difference :)

@karthik
Copy link
Member

karthik commented Apr 11, 2014

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

@stewid
Copy link
Member Author

stewid commented Apr 11, 2014

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())

@karthik
Copy link
Member

karthik commented Apr 11, 2014

Looks great. I've started work on replicating the commit graph from the main profile page as well.

@karthik
Copy link
Member

karthik commented Apr 11, 2014

I'll post that this weekend once I get it working correctly.

@karthik
Copy link
Member

karthik commented Apr 11, 2014

Your punch card looks slick!
image

We can extract the repo name too and add to the title.

@stewid
Copy link
Member Author

stewid commented Apr 11, 2014

Thanks. Great idea with title. Should we include it as a method punch_card?

@sckott
Copy link
Contributor

sckott commented Apr 11, 2014

looks great

@stewid
Copy link
Member Author

stewid commented Apr 12, 2014

Added method punch_card to package.

@petermeissner
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants