2015 in review (let me boast myself a bit :))

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 8,800 times in 2015. If it were a concert at Sydney Opera House, it would take about 3 sold-out performances for that many people to see it.

Click here to see the complete report.

Rename a Data Frame Within a Function Passing an Argument

Rename a Data Frame Within a Function Passing an Argument

This is not actually a real post but rather a code snippet surrounded by text.

Nevertheless I think it is a quite useful one: have you ever found yourself writing a function where a data frame is created, wanting to name that data frame based on a custom argument passed to the function?

For instance, the output of your function is a really nice data frame name in a really trivial way, like “result”.

But your dream is to let the user (or some piece of code behind the function) specify the data frame name, passing it as an argument of your function.

To achieve that you need to look at assign function, which let’s you access the hash table of a given environment (pos argument) and change the value of a given variable.

Find below a working function which applies this idea:

rename_df  =  function(choosen_name){
data_set  =  data.frame(column_A = c(1,4,6,7,8),column_B = c(seq(1:5)))
title  =  choosen_name
assign(title,data_set,pos = ".GlobalEnv")
}

Have you found any other way to get here? I would love to here it!

p.s.: wondering why I chose that image? well, is Adam naming animals.. 🙂

Data Visual 10/21: Plotly

Austin+Wehrwein

Plotly is a powerful data analysis tool, that can integrate data from a lot of outside languages and resources.

Here are the ones that are included:

Python MATLAB R Julia node.js Arduino

From Plotly:

Easily make graphs with your data in the workspace. Import data from Google Drive or upload Excel or text files. You can apply fits, stats, and functions to your data.

Every element of a Plotly graph is customizable. Change the colors, annotate, write LaTeX, toggle graph ticks, and much more. It’s up to you!

I used it for a couple projects that I then embedded on a website for public use. This is where my usage of WordPress gets me, I could embed the graph here but I am sacrificing the functional full use of the code on a regular website for the social, but restricted use of a WordPress site. Here is a flat image of…

View original post 15 more words

Learn dplyr with RStudio and Datacamp

RStudio Blog

datacamp-dplyr

RStudio has teamed up with Datacamp to create a new, interactive way to learn dplyr. Dplyr is an R package that provides a fast, intuitive way to transform data sets with R. It introduces five functions, optimized in C++, that can handle ~90% of data manipulation tasks. These functions are lightning fast, which lets you accomplish more things—with more data—than you could otherwise. They are also designed to be intuitive and easy to learn, which makes R more user friendly. But this is just the beginning. Dplyr also automates groupwise operations in R, provides a standard syntax for accessing and manipulating database data with R, and much more.

In the course, you will learn how to use dplyr to

  • select() variables and filter() observations from your data in a targeted way
  • arrange() observations within your data set by value
  • derive new variables from your data with mutate()
  • create summary statistics with

View original post 145 more words