DACSS 601 HomeWork 1
Introduction
Hello everyone, my name is Cynthia and this is my first blog post. Whew!! I am a first year MS student in the DACSS program. I look forward to learning with and from you all.
Cool stuff R can do
I am going to import data from the Air Passengers data set which is included in R. It is comprised of data from the monthly totals of international airline passengers, 1949 to 1960. I am going visually express the data on a histogram plot, which is a strength of R.
First, we are going to look at the first few rows of the Air Passengers argument using the head function in R which displays the first few rows of an argument. This is useful so the entire data set does not need be displayed.
head(AirPassengers)
[1] 112 118 132 129 121 135
Next, to get an idea of what is at the end of the Air Passengers data set we are going to use the tail function which as the name implies displays what is at the end of the data set.
tail(AirPassengers)
[1] 622 606 508 461 390 432
I then used the summary function which provided a descriptive statistical peek into the data set, such as median,mean, minimum, first quantile, and third quantile.
summary(AirPassengers)
Min. 1st Qu. Median Mean 3rd Qu. Max.
104.0 180.0 265.5 280.3 360.5 622.0
Here, I try out one of the visual strengths of R, in the form of a histogram of the data.
hist(AirPassengers,
main="Histogram for Air Passengers",
xlab="Passengers",
border="red",
col="green",
xlim=c(100,700),
las=1,
breaks=5)