Automated UKHR Archive CSV Retrieval and Database builder
This package was developed to be used in R. It is dedicated to the retrieval/importation of UKHR and Betfair Promo's CSV archive, and building a MySQL database with the data. A script is provided to automate the process, but some setup is required.
For Linux OS follow guides provided at (http://dev.mysql.com/doc/refman/5.7/en/linux-installation.html) * In the terminal, login to MySQL server using the created 'username' and 'password' during installation
mysql -u 'username' -p 'password' NOTE: Do not use apostrophes(')
CREATE DATABASE horse_racing; NOTE: Naming database other than 'horse_racing' will require changing database name in script.R
For Windows OS follow guides provided at http://dev.mysql.com/doc/refman/5.7/en/windows-installation.html Open up the MySQL Command Line Client item from your MySQL program group in your start menu Enter the password used during installation * In command line, send the query below to create database named 'horse_racing'
CREATE DATABASE horse_racing;
For MAC OS X follow guides provided at http://dev.mysql.com/doc/refman/5.7/en/osx-installation.html * In the terminal, login to MySQL server using the created 'username' and 'password' during installation
mysql -u 'username' -p 'password'
CREATE DATABASE horse_racing;
This package requires directories for UKHR and Betfair Promo's CSV archive to exist in order to store the files. Build seperate directories each for UKHR archive and Betfair Promo archive
dir1: /home/user/Documents/UKHR OR C:/user/Documents/UKHR
dir2: /home/user/Documents/UKHR/Prices OR C:/user/Documents/UKHR/Prices
This package also builds in race difference from mean, and squared difference from mean variables for any variable given by UKHR. Any variable you want the in race calculations done for require them to be placed in a Variables file and stored in the first directory(dir1) with UKHR's CSV archive. A sample Variables file is provided, but for illustration purposes: supose we want the in race difference of Rating variable provided by UKHR in our database.
This is as easy as including the line
Difference.Rating
in the Variables file. *NOTE: All variables must be seperated by a new line
Difference.Var1
Difference.Var2
Download script.R from this repo. Include your MySQL's username and password into dbConnect function on lines 6 and 7. Include your UKHR username and password on lines 13 and 14. * Supply the paths for dir1(UKHR) and dir2(Betfair Promo) on lines 17 and 18.
Once all these steps have been completed, install this package using the following:
install.packages('devtools')
library('devtools')
install_github('mrbub/UKHR')
Now just source the script.R file you modified to include all your information done in step 4, and let the package do the work for you!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.