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. bold italicize 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:

library(stringr)
library(plyr)
library(pander)

bl = read.csv("http://www.aejaffe.com/winterR_2016/data/Bike_Lanes.csv", as.is =TRUE)
bl2 = bl
bl2$numLanes = factor(bl2$numLanes)
mod2 = lm(length ~ numLanes, data = bl2)

mod = lm(length ~ factor(numLanes), data = bl)
smod = summary(mod)
ci = confint(mod)
mat = cbind(smod$coefficients[, "Estimate"], ci)
mat = data.frame(mat)
colnames(mat) = c("Beta", "Lower", "Upper")
mat$CI = paste0("(", round(mat$Lower, 2), 
                ", ", round(mat$Upper, 2), ")")
mat = mat[, c("Beta", "CI")]
mat$Variable = rownames(mat)
rownames(mat) = NULL
mat$Variable = str_replace(mat$Variable, fixed("factor(numLanes)"), "Number of Lanes: ")
mat = mat[, c("Variable", "Beta", "CI")]
mat$Variable = plyr::revalue(mat$Variable, c("(Intercept)" = "B0"))

I am a section

I am a subsection

pander(mat)
Variable Beta CI
B0 308.4 (189.53, 427.22)
Number of Lanes: 1 -30.48 (-150.7, 89.75)
Number of Lanes: 2 -50.83 (-171.42, 69.76)
pander(smod)
  Estimate Std. Error t value Pr(>|t|)
factor(numLanes)1 -30.48 61.29 -0.4972 0.6191
factor(numLanes)2 -50.83 61.48 -0.8267 0.4085
(Intercept) 308.4 60.59 5.09 4.006e-07
Fitting linear model: length ~ factor(numLanes)
Observations Residual Std. Error \(R^2\) Adjusted \(R^2\)
1631 277.7 0.001564 0.0003378
pander(mod)
Fitting linear model: length ~ factor(numLanes)
  Estimate Std. Error t value Pr(>|t|)
factor(numLanes)1 -30.48 61.29 -0.4972 0.6191
factor(numLanes)2 -50.83 61.48 -0.8267 0.4085
(Intercept) 308.4 60.59 5.09 4.006e-07

You can also embed plots, for example:

My number of cars are 50.

pvals =smod$coefficients[, "Pr(>|t|)"]
pvals = ifelse(pvals < 0.001, "< 0.001", round(pvals, 2))

The beta coefficient was significant (308.3767969, p < 0.001)

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