This is our old blog. It hasn't been active since 2011. Please see the link above for our current blog or click the logo above to see all of the great data and content on this site.

Share all of our Stats

Posted by Sean Forman on September 3, 2009

Ever wanted to make a statistical point on a blog, to a friend via e-mail, on twitter or in an internet forum? The data you need appears on this site, but we've got twenty columns of additional data and then you would have to cut and paste, delete what you don't need and then maybe add some html or bbcode to get it to look just right? So only the really crazy statheads even bother. We've now made that process much, much (maybe one more much) easier.

Stats tables on Baseball-Reference.com now have the option to modify and easily share nearly all of the data found on the site. Clicking on the SHARE tooltip found above most stat tables (see image), now calls up a dialog box that allows you to delete columns and/or rows and then get the stat table to cut and paste in any of eight useful formats.

When you click on SHARE, we add a pair of icons to each row and column in the table. Clicking on the icon deletes that particular row or column. Clicking on the or icon deletes all of the trailing rows or columns. Note that to guarantee sorting works right you should sort before deleting rows or columns. After you've got the data pared down to just what you need, you can then choose from any of the following options.

Output types

an html table - plain old vanilla html, that can be placed into a blog post or web page. You must be able to include html for this to work.

We give you the option to include or not include inline styles. Including them adds a basic set of styles to the table (see style="..." in td and th tags) that is portable, so the table should look more or less as it does on this site wherever you place the html code. With the styles off, there are no styles embedded in the table and it will appear as a basic table that you learned to do in HTML 101. We do add a class to the table and credit div of sr_share, so you can set your own styles using that if you plan on using a lot of our tables. The SR option is for use on SR blogs by our authors.

a link - you'll be given a url (http://bbref.com/....) that will send a viewer to a page on our site showing just this table. From that report page where there are further options for posting it to facebook, twitter, myspace, etc.

bbcode - (Bulletin Board Code) puts common internet forum codes in for the tables. Note that many internet forums do not allow table code. Be sure to preview your post before posting it.

a js widget - a snippet of javascript that can be embedded into a page and then when the page is loaded your table will appear where the snippet is placed. Be careful about the width of the table you include. Sites may or may not allow you to use this type of code.

an iframe - A different method to the js widget with similar results. You may need to change the size of the iframe (adjust the height and width tags) to get the proper size. Sites may or may not allow you to use this type of code.

pre-formatted text - data is presented in a fixed width space aligned format. This format works for most internet forum software. We include four options for this. html provides a purely html output with <pre> around the data. A bbcode version which places the credit link in bulletin board code. SB Nation places the credit link in SB Nation's format. And [code] wrap places the table within [code] tags which will work for a lot of internet forum software packages. If posting to an internet forum code wrap may be your best bet.

comma-separated - columns separations are replaced by commas. Copy and paste this data into excel and use the DATA -> Text to Columns command to place it into columns.

wiki - this output will produce a table in a format suitable for a mediawiki page (the software used for Wikipedia and BR Bullpen). We have two options. link places a mediawiki-formatted link back to our site and the other lists our site inside a <ref> tag suitable for inclusion on a Wikipedia page as is.

If you need a format we don't have here or need something tweaked to make it a simple cut and paste, let us know here or via our feedback page.

As an example we built this from Johnny Damon's Standard Batting Table sorting by HR and choose the html option:

Year Age Tm G PA HR BA OBP SLG OPS OPS+
2009 35 NYY 121 534 24 .293 .373 .524 .898 133
2006 32 NYY 149 671 24 .285 .359 .482 .841 115
2004 30 BOS 150 702 20 .304 .380 .477 .857 117
1998 24 KCR 161 710 18 .277 .339 .439 .779 100
2008 34 NYY 143 623 17 .303 .375 .461 .836 118
15 Seasons 2109 9341 207 .289 .356 .440 .796 105
Provided by Baseball-Reference.com: View Original Table
Generated 9/3/2009.

Here are most of the output options demonstrated on one page.

The only thing we ask when you share our data is that you do not remove the attribution from the data presentation. We are providing this as a free service and are not permitting the use of this tool without attribution.

Still on the To Do list:
Modify the play index scripts to use our table format instead of pre-formatted text. Probably two months off.
Roll this feature out to the other S-R sites. Probably over the next month or so.

4 Responses to “Share all of our Stats”

  1. Andy Says:

    This is a major accomplishment for the site. I got an email from a journalist who mentioned how much this site is already used in the press box at all games...imagine how easy it will be now for journalists and bloggers to use stats. I'll be waiting for the PI version too 🙂

  2. J.G. Preston Says:

    Hi Sean--Will you also add the Share feature to game logs and splits? Thanks...

  3. Sean Forman Says:

    J.G.

    The 2009 gamelogs and 2009 splits have the share link. The older pages require a multi-hour rebuild, so they will take a little longer to roll out.

  4. J.G. Preston Says:

    Thank you, Sean. I have used pre-formatted text/html to use a table in a Delphi forum post:

    http://forums.delphiforums.com/replayball/messages/?msg=15654.379

    Looks great! Earlier I had posted an html table on the forum:

    http://forums.delphiforums.com/replayball/messages?msg=20727.1

    Just as I learned math as a kid from baseball stats, I'll probably finally learn some web tricks the same way. Thanks again.