Programming with R and WoL Import

My choice of language when doing things that will take Excel a long time is R (http://cran.r-project.org/bin/windows/base/).  R is a relatively intuitive language compared to others while a bit slower. If you’ve ever used Excel or some other type of spreadsheet software, you have problem typed in a function such as “SUM()”.  These are simply user-friendly versions of what is done in R through “calling” functions.  For example in Excel, the sum function will sum up the values of all cells you put within the parenthesis.  In R, the same can be done through a function also called sum.  This is an example of what I mean by intuitive.  Functions are typically called by names indicative of their actual uses.  This is not a great example of why someone might choose to program rather than using nicely constructed programs such as Excel so let me give you a good simple one.

In Excel there is a function called “IF(a, b, c)”.  I mentioned this on my haste page.  This functions evaluates the truthfulness of the statement ‘a’.  ‘a’ can be something such as A1 = B1, where A1 and B1 are cells in Excel.  If this statement is true then the function ‘returns’ the value ‘b’, and if the statement is not true, it returns the value ‘c’.

Ex: IF(Male Taurens > Female Taurens, Males are Bigger, Females are Bigger)
Since male taurens are larger than female taurens, this statement would return “Males are Bigger”.

Now imagine that we would like to put a series of if statements nested within each other and use a bunch of different inputs from multiple cells in different tables. Suppose now we wanted to do a comparison between female tauren size and females from all other classes then repeat the same exercise with males.  This would be doable in Excel, but it would take you a bit longer.  In R, you could read the size of each class in as a variable and use it in your analysis without reading new information and denoting each variable by a name which is indicative of what it actually is (ex. Variable representing female tauren; good: femTauren; bad: cow).  Now imagine that we ‘re not discussing something which only has 10 categories or so, but something with 500,000 categories.  No longer would this exercise be viable to use in Excel. You could do it, but you could not interpret the results and interpretation is the ultimate goal for any type of data analysis.  Anyone can make pretty graphs or perform calculations but it’s the interpretation of these and the reasoning behind how they are set up that is most important.  Now a days, 500,000 could be considered a moderately sized data set.  If you think about the information that companies such as Google or even Blizzard go through then you can see more and more why programming is important.  We use programming to do things our humans minds would be able to do much slower.  A program or algorithm is only as smart as its maker.

In any case, what I have done is wrote an R program to import a WoL page and extract three tables “Healing Done”, “Buffs” under the Buffs Cast tab and “Power Gains” under the same tab.  This is very important to make things that I’m trying to analyze including the healing simulation as well as my analysis of the new trinkets.  If anyone is interested in using this themselves, once I clean up the program I can upload this to a pastebin file for you to download and use in R.

What the program does is using a random URL, it will important these tables from the HTML script.  This is basically what websites like Comparebot does but perhaps in a different method and more intelligently than me.  For my purposes, I’ve constructed the barebones of what I need.

Here’s an example url from the top ranking Holy Paladin from the Jin’rokh the Breaker HM fight. The URL must be from the character’s page, not the overall healing done page.  It should look like this:

ex_WoLstart

 

The function from the program is called “getWoLinfo”.  After downloading the R script you can simple run the whole program first.  Then in the R Console, you can input the following getWoLinfo(“http://www.worldoflogs.com/reports/rt-rp9nlc7jnv5n5to0/details/5/?s=192&e=412”)  Remember to include the double quotes on either side.  What the program will then output is the following tables.  The first one is the overall healing done, the second is the buffs cast and the third is the power gains cast.

ex_getWoLinfo

Recall that I had begun to compile manually a database of WoL reports with people who are using the new trinkets.  I can easily use this function to pull out the data I want to look at to compare between logs.  This will also help greatly in my simulation analysis where I plan to use WoL reports about player actions as a basis for optimizing gear, secondary stats, etc.

I will be doing an analysis on the updated trinkets very soon, potentially later today or tomorrow so look out for those.

Also, the reason I have not put up heroic guides is our guild has not downed them yet…RL things came up but we should be starting progression again next week so I might have some up then 🙂

 

 

Advertisements

One thought on “Programming with R and WoL Import

  1. It really is a fascinating standpoint. I didnt find out about the idea. Retain growing your website, brother!

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s