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:

years<-c(1980,1980, 1985, 1990)
scores<-c(34,44,56,83)
df<-data.frame(years, scores)
df[,1]
## [1] 1980 1980 1985 1990
df[,2]
## [1] 34 44 56 83
df$years
## [1] 1980 1980 1985 1990
df$scores
## [1] 34 44 56 83
df[df$scores < 50,]
##   years scores
## 1  1980     34
## 2  1980     44
df[df$years ==1980,"scores" ]
## [1] 34 44
subject_name<-c("meechie meech","the guy","Neo Meechie")
temperature<-c(98.1,98.6,101.4)
flu_status<-c(FALSE,FALSE, TRUE)
df<-data.frame(subject_name, temperature, flu_status)
df[,1]
## [1] "meechie meech" "the guy"       "Neo Meechie"
df[,2]
## [1]  98.1  98.6 101.4
df[,3]
## [1] FALSE FALSE  TRUE
temperature[-2]
## [1]  98.1 101.4
subject_name[1:3]
## [1] "meechie meech" "the guy"       "Neo Meechie"
flu_status[3]
## [1] TRUE
gender<-factor(c("MALE", "FEMALE", "MALE"))
gender[1]
## [1] MALE
## Levels: FEMALE MALE
blood<-factor(c("O", "AB", "A"), levels = c("A", "B", "AB", "O"))
symptoms<-factor(c("SEVERE", "MILD","MODERATE"), levels = c("MILD","MODERATE","SEVERE"), ordered = TRUE)
symptoms
## [1] SEVERE   MILD     MODERATE
## Levels: MILD < MODERATE < SEVERE
pt_data<-data.frame(subject_name, temperature, flu_status, gender, blood, symptoms, stringsAsFactors = FALSE)
pt_data
##    subject_name temperature flu_status gender blood symptoms
## 1 meechie meech        98.1      FALSE   MALE     O   SEVERE
## 2       the guy        98.6      FALSE FEMALE    AB     MILD
## 3   Neo Meechie       101.4       TRUE   MALE     A MODERATE
pt_data$gender
## [1] MALE   FEMALE MALE  
## Levels: FEMALE MALE
pt_data$temp_c<-(pt_data$temperature - 32) * (5/9)
pt_data
##    subject_name temperature flu_status gender blood symptoms   temp_c
## 1 meechie meech        98.1      FALSE   MALE     O   SEVERE 36.72222
## 2       the guy        98.6      FALSE FEMALE    AB     MILD 37.00000
## 3   Neo Meechie       101.4       TRUE   MALE     A MODERATE 38.55556

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.