R/mySOreputation.R
mySOreputation.Rd
It is very easy to view a detailed account of your reputation at any
of the Stack Exchange sites by visiting http://"sitename"/reputation
(obviously substituting "sitename" for the actual site of interest, for
example, http://stackoverflow.com/reputation). However, that format
is not very user-friendly if you want to do any analysis with it. This
function parses that page into an R data.frame
.
mySOreputation(rep_file)
rep_file | The path to a text version of your reputation page. Windows and Linux users can copy the text on the page with select all + copy, and simply use "clipboard" instead of saving the contents to a local file. |
---|
Values for the "actions" variable determined after visiting
http://meta.stackexchange.com/a/43005/214964.
There is one value not mentioned at that page, coded as action_id ==
99
and action == Bonus
that corresponds to the bonus that a user
gets when they have above a certain reputation and are active on multiple
Stack Exchange sites.
Paul Hiemstra provided the base parser. Built upon by Ananda Mahto.
## This is a real reputation file, ## but the "question_id" variable is ## made up. rep_file <- system.file("soreputation.txt", package = "SOfun") readLines(rep_file, 15)#> [1] "total votes: 3092" " 2 9170090 (10)" #> [3] " 2 8533006 (10)" " 2 8783724 (10)" #> [5] " 2 5173844 (10)" "-- 2012-03-15 rep +40 = 41" #> [7] " 2 9199717 (10)" " 2 7256057 (10)" #> [9] "-- 2012-03-16 rep +20 = 61" " 2 6145733 (10)" #> [11] " 1 7509549 (15)" " 2 3788812 (10)" #> [13] " 2 1347644 (10)" "-- 2012-03-17 rep +45 = 106" #> [15] "-- 2012-03-25 rep 0 = 106"#> action_id question_id rep_change date actions #> 1 2 9170090 10 2012-03-15 Upvote #> 2 2 8533006 10 2012-03-15 Upvote #> 3 2 8783724 10 2012-03-15 Upvote #> 4 2 5173844 10 2012-03-15 Upvote #> 5 2 9199717 10 2012-03-16 Upvote #> 6 2 7256057 10 2012-03-16 Upvote #> 7 2 6145733 10 2012-03-17 Upvote #> 8 1 7509549 15 2012-03-17 YourAnswerAccepted #> 9 2 3788812 10 2012-03-17 Upvote #> 10 2 1347644 10 2012-03-17 Upvote #> 11 1 6964418 15 2012-03-28 YourAnswerAccepted #> 12 16 5000073 2 2012-04-07 EditApproved #> 13 1 1560102 15 2012-04-10 YourAnswerAccepted #> 14 1 1016692 2 2012-04-11 AnswerAcceptedByYou #> 15 2 1654001 5 2012-04-11 Upvotestr(mydf)#> 'data.frame': 2088 obs. of 5 variables: #> $ action_id : Factor w/ 9 levels "1","2","3","4",..: 2 2 2 2 2 2 2 1 2 2 ... #> $ question_id: int 9170090 8533006 8783724 5173844 9199717 7256057 6145733 7509549 3788812 1347644 ... #> $ rep_change : num 10 10 10 10 10 10 10 15 10 10 ... #> $ date : Date, format: "2012-03-15" "2012-03-15" ... #> $ actions : Factor w/ 11 levels "AnswerAcceptedByYou",..: 3 3 3 3 3 3 3 2 3 3 ...