R Programming rearranging rows and colums from timeline data
This would do the job:

#install packages
library(qdapTools)
library(dplyr)
#set working directory
setwd("C:/Users")

#read csv
test &lt;- read.csv("test.csv")

#create dummy variable
#test.new &lt;- dummy.data.frame(test$Sale.Type, sep = ".")
test.new &lt;- cbind(test, mtabulate(test$Sale.Type))

#rename column
names(test.new)[names(test.new) == 'Cash Sale'] &lt;- 'cashsale'

#making new columns
test.new1 &lt;- test.new %&gt;%
                group_by(Vehicle) 

test.new2 &lt;-  test.new1 %&gt;%
                  mutate(sum_Cashsale = sum(cashsale)) %&gt;%
                  mutate(sum_Ins = sum(Installment)) %&gt;%
                  mutate(sum_Lease = sum(Lease))

#select few necessary colums
test.new3 &lt;- subset(test.new2, select=c("Vehicle", "sum_Cashsale", "sum_Ins","sum_Lease"))

#select the distict rows
test.new4 &lt;- dplyr::distinct(test.new3)


Just copy paste the code. 
saved your sample data to test.csv
Give your working directory details, do let me know if you have any issues.