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:

data<-c(1,2,3,4,5,6)
data
## [1] 1 2 3 4 5 6
vstring<-c('a','b','c')
vstring
## [1] "a" "b" "c"
headings<-list(NULL, c("a", "b", "c"))
headings
## [[1]]
## NULL
## 
## [[2]]
## [1] "a" "b" "c"
m<-matrix(data, nrow=2, ncol=3,byrow=TRUE,dimnames=headings)
m
##      a b c
## [1,] 1 2 3
## [2,] 4 5 6
m2<-matrix(data, nrow=2, ncol=3,byrow=FALSE,dimnames=headings)
m2
##      a b c
## [1,] 1 3 5
## [2,] 2 4 6
m3<-matrix(data, nrow=3, ncol=2, byrow=TRUE)
m3[1,]
## [1] 1 2
m3[,2]
## [1] 2 4 6
m3[3,2]
## [1] 6
a<- list(aa=1, bb=2, cc=3)
a
## $aa
## [1] 1
## 
## $bb
## [1] 2
## 
## $cc
## [1] 3
years <- c(1980, 1985, 1990)
scores <- c(34, 44, 83)
df <- data.frame(years, scores)
df[,1]
## [1] 1980 1985 1990
df$years
## [1] 1980 1985 1990
df$scores
## [1] 34 44 83
View(df)
a <- 66
if(a>55){print("a is more than 55")}else {print("a is less than or equal to 55")}
## [1] "a is more than 55"

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.