Blog Archives

How to use jailbreakr

February 17, 2017
By

What is jailbreakr The jailbreakr package is probably one of the most interesting packages I came across recently. This package makes it possible to extract messy data from spreadsheets. What is meant by messy? I am sure you already had to deal with spreadsheets that contained little tables inside a single sheet for example. As far as I know, there...

Read more »

How to use jailbreakr

February 17, 2017
By

What is jailbreakr The jailbreakr package is probably one of the most interesting packages I came across recently. This package makes it possible to extract messy data from spreadsheets. What is meant by messy? I am sure you already had to deal with spreadsheets that contained little tables inside a single sheet for example. As far as I know, there...

Read more »

Functional programming and unit testing for data munging with R available on Leanpub

December 23, 2016
By

The book I’ve been working on these pasts months (you can read about it here, and read it for free here) is now available on Leanpub! You can grab a copy and read it on your ebook reader or on your computer, and what’s even better is that it is available for free (but you can also decide to...

Read more »

My free book has a cover!

December 23, 2016
By
My free book has a cover!

I’m currently writing a book as a hobby. It’s titled Functional programming and unit testing for data munging with R and you can get it for free here. You can also read it online for free on my webpage What’s the book about? Here’s the teaser text: Learn the basics of functional programming, unit testing and package development for the R...

Read more »

Work on lists of datasets instead of individual datasets by using functional programming

December 20, 2016
By

Analyzing a lot of datasets can be tedious. In my work, I often have to compute descriptive statistics, or plot some graphs for some variables for a lot of datasets. The variables in question have the same name accross the datasets but are measured for different years. As an example, imagine you have this situation: data2000

Read more »

I’ve started writing a ‘book’: Functional programming and unit testing for data munging with R

I have started writing a ‘book’ using the awesome bookdown package. In the book I explain and show why using functional programming and putting your functions in your own packages is the way to go when you want to clean, prepare and transform large data sets. It makes testing and documenting your code easier. You don’t need to think about managing...

Read more »

Merge a list of datasets together

Last week I showed how to read a lot of datasets at once with R, and this week I’ll continue from there and show a very simple function that uses this list of read datasets and merges them all together. First we’ll use read_list() to read all the datasets at once (for more details read last week’s post): library("readr") library("tibble") data_files

Read more »

Read a lot of datasets at once with R

I often have to read a lot of datasets at once using R. So I’ve wrote the following function to solve this issue: read_list

Read more »

Data frame columns as arguments to dplyr functions

Suppose that you would like to create a function which does a series of computations on a data frame. You would like to pass a column as this function’s argument. Something like: data(cars) convertToKmh % summarise(mean_speed = mean(speed)) -__ dataset return(dataset) } simpleFunction(cars, "dist") A tibble: 35 x 2 dist mean_speed 1 ...

Read more »

Careful with tryCatch

tryCatch is one of the functions that allows the users to handle errors in a simple way. With it, you can do things like: if(error), then(do this). Take the following example: sqrt("a") Error in sqrt("a") : non-numeric argument to mathematical function Now maybe you’d want something to happen when such an error happens. You can achieve that with tryCatch: tryCatch(sqrt("a"), error=function(e) print("You can't take...

Read more »

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)