Response: This can be accomplished using the reshape2 package which uses efficient reshaping of data leveraging “data.tables”. require(reshape2)
uspexp <- melt(USPersonalExpenditure)
names(uspexp)[1:2] = c('category', 'year')
solution <- xPlot(value ~ year, group = 'category', data = uspexp,
type = 'line-dotted') solution We can use XCharts by picking up category and year parameters and use the xPlot() to accomplish the desired plot representation as shown in below output chart.