Your verification ID is: guDlT7MCuIOFFHSbB3jPFN5QLaQ Big Computing: An example of using ggvis package in R with pipes for data visualization

Thursday, June 4, 2015

An example of using ggvis package in R with pipes for data visualization

This is a example of using the ggvis package with pipes. The ggvis package is a futher development of the ggplot package and designed around the grammar of graphics. This is a very easy to use package the combined with pipes provides asy to read code

First you will need to load install the ggvis package

install.packages("ggvis")

Then you will need to require that package

require(ggvis)
## Loading required package: ggvis

For the first example we are going to uses the build in R data set mtcars. Actually using ggvis without using pipes makes the code look kinda ugly

layer_points(ggvis(mtcars,x = ~wt,y = ~mpg,fill = ~disp,shape = ~factor(cyl)))


As you can see the second code chunk is much easier to read. First is what data set are you using, Second is what are you x and y values and the how points are going to presented (color, shape, etc). Finally it say what kind of graph this is (points, lines, etc). That is basically it.

Just for fun lets do a graph with the iris data set. This is kind fun because unlike the mtcars data set which is really a regression sdata set the iris data set is a classification data set. So we are not looking to see if we can find a trend line but rather how the variable define the groups. In this case that is what species is the iris (setosa, versicolor, virginica). So here is the plot:

iris %>%
  ggvis(x = ~Sepal.Length,y = ~Sepal.Width,fill = ~factor(Species)) %>%
  layer_points()


Pretty cool

7 comments:

  1. You have a real ability for writing unique content. I like how you think and the way you represent your views in this article. I agree with your way of thinking. Thank you for sharing.
    unblocked games| unblocked games at school| unblocked games| friv4school| friv for school| friv games| frivgames| kizi2| kizi 2
    unblockedgames| unblocked games at school| friv 4 school| friv4school| free online games| free online games| jogos da barbie| kizi

    ReplyDelete
  2. The article you have shared here very awesome. I really like and appreciated your work. I read deeply your article, the points you have mentioned in this article are useful. I must try to follow these points and also share others.
    happy wheels
    super mario bros
    pacman
    agario

    ReplyDelete
  3. I am really enjoying reading your well written Information. I have read your post carefully and relies that this is a very helpful for me
    happy wheels | friv | girlsgogames | games2girls | happy wheels

    ReplyDelete
  4. Have you been using this messaging app yet? If not, try to use it, you will be surprised about its special features
    snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat , snapchat

    ReplyDelete