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 […]
R Tips
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 […]
Slide Decks and Packages in Tweets from 2018 rstudio::conf
2018 RStudio conference, one of the interesting conferences for anyone interested in R and RStudio just ended over the weekend. In case you missed it, twitter was abuzz with interesting bytes from the conference, including cool new R package that was presented and slides of the talks. Here is a compilation of tweets containing slides, […]
Why can’t ggplot2 use %>% instead of “+”?
Have you ever mixed up dplyr’s pipe operator or magittr %>% with ggplot’s “+” while piping dplyr commands with ggplot2, you are not alone. Depending on where you misused “%>%” for “+”, you might get confusing errors like Error: Mapping must be created by `aes()` or `aes_()` Error in as.vector(x, “character”) : cannot coerce type […]
6 Most Useful dplyr Commands to Manipulate a Data Frame in R
dplyr is one of the R packages developed by Hadley Wickham to manipulate data stored in data frames. Data frame is a two-dimensional data structure, where each column can contain a different type of data, like numerical, character and factors. In case you wondered the meaning of the word “dplyr”, it is like “pliers” for […]