by Kevin Rosamont

Launching your shiny app in 2 clicks

I’m sure that you have though about it at least once! Just double cliking on an icon to launch your shiny application. Read this short post and you will be abble to launch your app without opening R.

Read more → Hello everyone, Why we always want to take the red pill when we can take the blue one? That’s the question! In this post I will explain how to launch a shiny application from a shortcut. Just like that: It’s fast and useful if you work with colleagues that don’t have a clue about R and just want to use your shiny app. If you are on macOS: Open a text editor and write the following lines :

by Bruno Rodrigues (guest)

Skip errors in R loops by not writing loops

Avoid loops that stop mid-way by using safely() and possibly() from purrr… and not using loops in the first place. Let me show you what I mean through examples.

Read more → You probably have encountered situations similar to this one: result = vector("list", length(some_numbers)) for(i in seq_along(some_numbers)){ result[[i]] = some_function(some_numbers[[i]]) } print(result) First I initialize result, an empty list of size equal to the length of some_numbers which will contains the results of applying some_function() to each element of some_numbers. Then, using a for loop, I apply the function. This is what I get back: NaNs producedError in sqrt(x) : non-numeric argument to mathematical function Let’s take a look at some_numbers and some_function():

by Kevin Rosamont

Visualizing box office revenue by genre

I love going to the cinema don’t you? But I also like playing with data. Hence, I will show you how we can link these 2 elements by making a nice treemap using R.

Read more → After having watched Justice League in cinema, I was impressed by all of the special effects and how good they were. I started wondering myself: How much does a movie like that cost? And most importantly, how big is the box-office revenue for this kind of blockbuster? I found an answer in The Numbers. I have then decided to make a database from the data available on this website. I have retrieved the 500th biggest movie budgets.

by Bruno Rodrigues (guest)

Functional peace of mind

I think what I enjoy the most about functional programming is the peace of mind that comes with it. Let me show you what I mean through examples.

Read more → I think what I enjoy the most about functional programming is the peace of mind that comes with it. With functional programming, there’s a lot of stuff you don’t need to think about. You can write functions that are general enough so that they solve a variety of problems. For example, imagine for a second that R does not have the sum() function anymore. If you want to compute the sum of, say, the first 100 integers, you could write a loop that would do that for you: