I am new to R and stackoverflow. It is arranged by Name and ActivityDate. I am trying to add LastSaleDate to my dataframe. I am trying to get LastSaleDate only within that group(by Name). I tried to do something with dplyr but to no avail. Your help is greatly appreciated.
Name ActivityType ActivityDate SalesAmount LastSaleDate(Desired)
John Email 1/1/2014 NA NA
John Sale 2/1/2014 1000 NA
John Sale 3/1/2014 2000 2/1/2014
John Seminar 4/1/2014 NA 3/1/2014
John Webinar 5/1/2014 NA 3/1/2014
Tom Email 1/1/2014 NA NA
Tom Sale 2/1/2015 1000 NA
Tom Sale 3/1/2015 2000 2/1/2015
Tom Seminar 4/1/2015 NA 3/1/2015
Tom Webinar 5/1/2015 NA 3/1/2015