9 Ways To Create New Variables with tidyverse

When one wants to create a new variable in R using tidyverse, dplyr’s mutate verb is probably the easiest one that comes to mind that lets you create a new column or new variable easily on the fly. It is probably the go to command for every time one needed to make new variable for… Continue reading 9 Ways To Create New Variables with tidyverse

How To Collapse Multiple Text Columns in Dataframe Using Tidyverse?

Often you may have a data frame, where multiple columns are related and you may want to combine those related columns into a single column. In an earlier post, we saw how we can collapse a numerical data frame with related columns using Python. In this post, we consider the problem of collapsing or combining… Continue reading How To Collapse Multiple Text Columns in Dataframe Using Tidyverse?

How to Split Text in a Column in Data Frame in R?

Very often you may have to manipulate a column of text in a data frame with R. You may want to separate a column in to multiple columns in a data frame or you may want to split a column of text and keep only a part of it. tidyr’s separate function is the best… Continue reading How to Split Text in a Column in Data Frame in R?

5 Big Ideas Behind Tidy Evaluation

Ever wondered, how easy it is to write dataframe manipulation code without repeating yourself while using dplyr ? For example, if you are filtering a dataframe, you simply write instead of writing like this where you need to refer the dataframe multiple times and use “$” to access variables in the dataframe. The reason why… Continue reading 5 Big Ideas Behind Tidy Evaluation

7 ways to read files with readr package in R

There are multiple ways read text files in rectangular, like csv file, tsv file or text file with common delimitters. readr package, part of tidyverse, offers seven functions to load flat text files easily. How to load a text file with readr package? read_csv(): to read comma delimited files read_csv2(): to read semicolon separated files… Continue reading 7 ways to read files with readr package in R