My quest through R+Rstudio

** Getting Started **

As any journey to knowledge begins, one must start with school, code school in this that i have successfully graduated. My ” Diploma” below for you to view. This school will teach you, as it thought me, the language you need to operate R studio ( to which i will come later). it is free of charge on http://tryr.codeschool.com. without it one might ague that this quest will not be completed.

Once you also have graduated code school, you’ll have to Download R, followed by R-studio. Both applications are available online and also free of charge ( how amazing is that?).

Now that you have R studio on your desktop the code writing can begin. On this particular quest we are going to use information obtained from the internet to create a chart using R studio.

** My Material **

I personally have a deep passion for original music, the type that was originally sold on Vinyl Records. After noticing an increase in demand and consequently in price over the last couple of years I’ve decided to look into this phenomenon. Following a long research I’ve come to the conclusion that through the rise of “Hipster” or at least correlating with it, the sale of the Vinyl record has also increased. The source that I used ( The Nielsen Company) has aligned the sales in unit with the last 12 years. you too will be quite baffled with the result.

** put it into practice **

With your previously acquired knowledge in code school you will now use the information you have found to write the code and turn your statistics into visual form. At this point I would also like to mention that the website cookbook-r.com is also incredibly helpful when it comes to creating charts, graphs, or bars. The code that I used to create a data table and then the bar is found below. it took a couple of try outs to get it and right and a little consultation but you know what they say, practice makes the master.

————————————————————————————————–

dat<-data.frame(
Year= factor(c(“1993″,”1996″,”1999″,”2002″,”2005″,”2008″,”2011”),
levels = c(“1993″,”1996″,”1999″,”2002″,”2005″,”2008″,”2011”)),
Vinyl_sales=c(0.3,1.1,1.4,1.3,0.9,1.9,3.6)
)
dat
install.packages(“ggplot2”)
library(“ggplot2″)
ggplot(data=dat, aes(x=Year, y=Vinyl_sales)) +
geom_bar(stat=”identity”)+ggtitle(“Sales of Vinyl Records”)


** The final Result**

The above code must be typed in the top part of R-studio, When that is done you are ought to select it until all of the text is covered, then “Run” it by clicking the button run on the top right corner. If your code is correct you will Receive a bar chart ( in this case) under Plots. You can view the final Result below. The Y values are in millions, I find that like this they are represented the best. I tried to type for example ‘1.3Mio.’ with no success as the program seems to need a value of only text or numbers.

<- Zoomed in bar chart

 <– Complete Window

And your quest is herewith complete…

That’s all Volks, Till the Next time 😉 ..

Leave a Reply

Your email address will not be published. Required fields are marked *