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:

<!-- library(rattle) -->
<!-- library(ggplot2) -->
<!-- library(caret) -->
<!-- library(rpart) -->
<!-- library(rpart.plot) -->
<!-- library(corrplot) -->
<!-- library(corrplot) -->
<!-- library(RColorBrewer) -->
<!-- library(lattice) -->
<!-- library(randomForest) -->
<!-- library(plotly) -->
<!-- library(gbm) -->
<!-- set.seed(222) -->

<!-- url_train <- "http://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv" -->
<!-- url_quiz  <- "http://d396qusza40orc.cloudfront.net/predmachlearn/pml-testing.csv" -->
<!-- data_train <- read.csv(url(url_train), strip.white = TRUE, na.strings = c("NA","")) -->
<!-- data_quiz  <- read.csv(url(url_quiz),  strip.white = TRUE, na.strings = c("NA","")) -->

dim(data_train)
dim(data_quiz)

in_train <- createDataPartition(data_train$classe, p = 0.75, list = FALSE)
train_set <- data_train[in_train,]
test_set <- data_train[-in_train,]
dim(train_set)

dim(test_set)
nzv_var <- nearZeroVar(train_set)
train_set <- train_set[,-nzv_var]
test_set <- test_set[,-nzv_var]
dim(train_set)
dim(test_set)

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.