This last weeks I’ve been doing my exercises regarding Communities of Free/Libre Software subject, and all this exercises were made using R and MySQL.
R is an statistic application under GNU GPL license, and MySQL is the world famous free software database, now under the ownership of Oracle. This database follows a dual licensing model, with a privative version and GNU GPL one.
Also with this two tools, I’ve used also CVSAnalY, an application to get information of the source code repository developed by Libresoft (the research team which has created my M.Sc. on Free/Libre Software).
So in this post I’m going to talk about the process since we get the source code, to when we get a chart based in queries performed to the data.
1- First we need to download a project from cvs, svn or git, to allows CVSAnalY
gets the information.
In this practice I’m going to use the project Subversion which is allocated also in a svn scm.
We need to write this in our terminal:
svn co http://svn.apache.org/repos/asf/subversion/trunk subversion
2- Then we already have our subversion project in a folder. Is time to use CVSAnalY:
cvsanaly2 –db-user <<YOUR_DB_USER>> –db-password <<YOUR_DB_PASSWD>> [DATABASE]
(if you don’t specify nothing the default database will be cvsanaly)
Then, once CVSAnalY have just finish to parse the project we’ll have a complete database with its tables which we’ll use to get data.
3- Now we can go with R and MySQL.
This procedure you can doing in a different way but, as R allows to work wiith MySQL in the self R console, we’re going to explain this solution:
With this instruction we connect R with MySQL and using the database specified:
con <- dbConnect(dbDriver(“MySQL”), user=”<<USER>>”, password=”<<PASSWD>>”, dbname=”<<DDBB>>”);
Now you can perform any query that you think using:
query <- “<<YOUR_QUERY>>”
ie: query <– “Select * from scmlog”
And then with this other instruction we send the query to MySQL and we get a result which will be in the results variable:
results <- dbGetQuery(con, query)
For to see the result, you must to write only:
And then the table with the results shows you.
So, using this way to create queries and execute over your database is a very powerful way to get information, but sometimes is good to have a chart to see more clear.
plot(<<X_DATA>>, <<Y_DATA>>, xlab=”<<X_LABEL>>”, ylab=”<<Y_LABEL>>”, main=”<<MAIN_LABEL”)
So that’s all I hope this will be useful for you, and maybe it will be a first and easy approach to R, MySQL and CVSAnalY.
See you my friends!!