Professional Documents
Culture Documents
Assignment 1
Name : Rana Tanvir
ID: 18012901
My Team mate has drop the class that’s why I have done by myself
• Answer 3.1 a)
• 1. Import ApplianceShipment.csv file
• 2. View(ApplianceShipments)
• 3. summary (ApplianceShipments)
• 4. shipment.ts=ts (ApplianceShipments $Shipments, start
• = c(1985,1),end = c(1989,4), frequency = 4)
• 5. plot(shipment.ts, xlab="Year", ylab = "Shipment (in million $)")
Answer 3.1 b)
1. Import ApplianceShipment.csv file
2. View(ApplianceShipments)
3. summary(ApplianceShipments)
2. View (ApplianceShipments)
3. summary(ApplianceShipments)
= c(1985,1),end = c(1989,4),frequency = 4) 5. plot (shipment.ts, xlab="Year", ylab = "Shipment (in million $)", ylim = c(3500, 5000))
6. library(ggplot2)
7. par(oma = c(0,0,0,2))
10. plot(xrange, yrange, main = "Shipments by Quarter", type = "n", xlab="Year", ylab =
15. legend (5.25,4800, 1:4, cex=0.8, col=colors, pch=plotchar, Ity-linetype, title="Quarter", xpd=NA)
Answer 3.1 d)
1. Import ApplianceShipment.csv file
2. View(ApplianceShipments)
3. summary(ApplianceShipments)
4. shipment.ts=ts (ApplianceShipments $Shipments, start = c(1985,1),end = c(1989,4),frequency = 4)
5. plot(shipment.ts, xlab="Year", ylab = "Shipment (in million $)", ylim = c(3500, 5000))
6. library(ggplot2)
7. par(oma = c(0,0,0,2))
8. xrange <- c(1,5)
9. yrange <- range (shipment.ts)
10. plot(xrange, yrange, main = "Shipments by Quarter", type = "n", xlab="Year", ylab =
"Shipments", bty = "I")
11. colors <- rainbow(4)
12. linetype <- c(1:4)
13. plotchar <- c(1:4)
14. for (i in 1:4) {current_quarter <- subset(shipment.ts,cycle(shipment.ts)==i)
lines (current_quarter, type="b", lwd=1.5, Ity=linetype[i], col=colors[i], pch=plotchar[i])
} 15. legend (5.25,4800, 1:4, cex=0.8, col=colors, pch=plotchar, Ity=linetype, title="Quarter",
xpd=NA) 16. yearly <- aggregate (shipment.ts, nfrequency=1, FUN=sum)
17. plot(yearly, bty="I")