Category: General Functions

Posted on: December 5, 2017 Posted by: Guy Manova Comments: 0

Running totals (cumulative sums) in R

Running totals (cumulative sums) in R in this short tutorial, learn how to create Running totals (cumulative sums) in R using cumsum() in different scenerios including pivot table, just like you would use Excel’s pivot table “show values as” and selecting “running total” or “% running total” In Excel   …

Posted on: November 4, 2017 Posted by: Guy Manova Comments: 0

Nested ifs in R

Excel nested ifs in R with the nested ifelse function In this short tutorial you can learn to replicate an Excel nested ifs functionality in R using nested ifelse statements or dplyr’s case_when function. If you want to look at a non nested simple ifelse, check out this post here: …

Posted on: October 28, 2017 Posted by: Guy Manova Comments: 0

simple if statement in R with ifelse

Simple if statement in R with ifelse Let’s see how to create the equivalent of Excel’s simple if statement in R using the ifelse function in base R and with dplyr: In Excel:   In R: # pre-session options rm(list = ls()) #getwd() #setwd(“C:\\Users\\User\\Documents”)   if (!require(dplyr)) install.packages(‘dplyr’) library(dplyr) campaigns …

Posted on: October 2, 2017 Posted by: Guy Manova Comments: 0

Remove duplicates in R

Removing duplicates in R In this tutorial we’ll see how to dedupe your data set – we’ll remove duplicates in R and compare it to Excel you can follow the step by step code below or download the R file from github:   # pre-session options rm(list = ls()) # …

Posted on: September 17, 2017 Posted by: Guy Manova Comments: 0

Sums, means and other aggregates on Columns and Rows

How to quickly create a totals row (or column) for an R dataframe Follow the step by step tutorial to create a totals row for an R matrix or dataframe.   pre-session options rm(list = ls()) getwd() setwd(“C:/Users/your preferred path”) Let’s see various totals vectors to the Hitters and mtcars …

Posted on: September 16, 2017 Posted by: Guy Manova Comments: 0

Sumif,sumifs, countif, countifs etc in R

sumif in R (and sumifs, countifs etc.) follow this step by step to learn how to mimic some conditional summary excel functions such as sumif in R. you can copy paste code into Rstudio below, or just download the entire R file from github: Pre-session notes: As always, in order …