median(x) median(x,na.rm=FALSE){r}
x<-c(12,7,3,4,.2,18,2,54,-21,8,-5,NA)
result.mean<-mean(x,na.rm=TRUE)
print(result.mean)
## [1] 7.472727
result.mean<-mean(x,na.rm=FALSE)
print(result.mean)
## [1] NA
median(x)
## [1] NA
median(x,na.rm=FALSE)
## [1] NA
median(x,na.rm=TRUE)
## [1] 4
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(readr)
ChildrenAsthma_Survey <- read_csv("C:/Users/Ceesay2032/Documents/machine learning/ChildrenAsthma Survey.csv")
## New names:
## Rows: 20 Columns: 9
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," dbl
## (9): ...1, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
print("hello")
## [1] "hello"
View(ChildrenAsthma_Survey)
cas<-ChildrenAsthma_Survey
cas
## # A tibble: 20 × 9
## ...1 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 13 2 1 1 2 1 3 1
## 2 2 5 2 4 1 3 1 3 0
## 3 3 7 1 5 1 1 1 6 1
## 4 4 14 2 6 1 4 9 1 0
## 5 5 6 1 6 1 5 0 1 0
## 6 6 2 1 5 1 1 1 6 1
## 7 7 10 2 4 1 4 0 2 9
## 8 8 9 2 3 1 3 1 2 0
## 9 9 8 2 2 1 1 1 6 1
## 10 10 8 2 1 1 2 1 1 9
## 11 11 7 1 1 1 2 1 3 9
## 12 12 3 1 5 1 1 1 5 0
## 13 13 4 1 5 1 3 1 3 0
## 14 14 16 1 6 1 1 1 5 1
## 15 15 18 2 7 1 4 0 1 1
## 16 16 12 1 2 1 5 0 2 0
## 17 17 2 2 3 1 3 1 4 9
## 18 18 15 1 4 1 1 1 5 0
## 19 19 11 2 5 1 3 0 4 0
## 20 20 12 1 6 1 1 1 4 1
avaage<-mean(cas$Q1)
avaage
## [1] 9.1
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.