On this Markdown I’ll show you the results of the 2nd Assignment
First I create 2 values, one for Months and other for unemployment Rate as “month” and “unemplo_rate” respectively.
unemploy_rate<-c(7.9,7.7,7.5,7.5,7.5,7.5,7.3,7.2,7.2,7.2,7.0,6.7)
month=c("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec")
Then I convert the months into a Factor
month<-factor(month)
Then I create a data.frame with both values (month,unemploy_rate)
monthly_rate<-data.frame(month,unemploy_rate)
Validate the data.frame with print function
print(monthly_rate)
## month unemploy_rate
## 1 jan 7.9
## 2 feb 7.7
## 3 mar 7.5
## 4 apr 7.5
## 5 may 7.5
## 6 jun 7.5
## 7 jul 7.3
## 8 aug 7.2
## 9 sep 7.2
## 10 oct 7.2
## 11 nov 7.0
## 12 dec 6.7
And solve the exercises 1) extract the unemplyment rate of march & 2) extract those months where unemplyment were below 7.5%
subset(monthly_rate,month=="mar",)
## month unemploy_rate
## 3 mar 7.5
which(monthly_rate$unemploy_rate<7.5)
## [1] 7 8 9 10 11 12
And then I activate the Package Latexpdf to print the Markdown. Library(Latex)
Finally, here are the answers for the questions G,H & I.
A:Factors are a way to group categorical data into levels and are used to group with finite values, such as the countries in the world, the football teams of England, or in this case, the months of the year
A: The unique about a numeric variable is that we can use them in arithmetical operations and also, they can be transformed into character variables.
a:The use of data frames applies when we need to create tables of data or matrix, where we have rows and columns with different data.
Thanks