data(longley)
head(longley)
##      GNP.deflator     GNP Unemployed Armed.Forces Population Year Employed
## 1947         83.0 234.289      235.6        159.0    107.608 1947   60.323
## 1948         88.5 259.426      232.5        145.6    108.632 1948   61.122
## 1949         88.2 258.054      368.2        161.6    109.773 1949   60.171
## 1950         89.5 284.599      335.1        165.0    110.929 1950   61.187
## 1951         96.2 328.975      209.9        309.9    112.075 1951   63.221
## 1952         98.1 346.999      193.2        359.4    113.270 1952   63.639
model <- glm( GNP~  Unemployed + Armed.Forces, data =longley )

model
## 
## Call:  glm(formula = GNP ~ Unemployed + Armed.Forces, data = longley)
## 
## Coefficients:
##  (Intercept)    Unemployed  Armed.Forces  
##     -64.8144        0.7506        0.8164  
## 
## Degrees of Freedom: 15 Total (i.e. Null);  13 Residual
## Null Deviance:       148200 
## Residual Deviance: 47180     AIC: 181.2
linear_model<-lm(GNP~  Unemployed + Armed.Forces, data =longley )
linear_model
## 
## Call:
## lm(formula = GNP ~ Unemployed + Armed.Forces, data = longley)
## 
## Coefficients:
##  (Intercept)    Unemployed  Armed.Forces  
##     -64.8144        0.7506        0.8164

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.