-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppt-4_package.Rmd
73 lines (59 loc) · 1.65 KB
/
ppt-4_package.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: "data and R packages"
author: ""
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
ioslides_presentation: default
slidy_presentation: default
beamer_presentation: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
```
<style> #slideSty80 > p { margin-top: -80px; } </style>
## R data
- R comes with several inbuilt datasets
```{r, eval=TRUE}
data("iris")
head(iris)
```
# packages
## Packages
- R comes with basic functions that you will use on a daily basis
- Sometime you will required spelize functions, written by others
- R package is collection of functions and data written for a specific task
## Install a package
- To install an R package use the command **install.packages("package name")**
- In this example we install the package **beeswarm**
```{r, eval=FALSE}
install.packages("beeswarm")
```
## Load a package {#slideSty80}
- Now we load the package and use a function from it
```{r}
library("beeswarm")
data("iris")
beeswarm(iris[, c("Sepal.Length", "Sepal.Width")],
pch = 16, col=c("red", "blue"),
labels = c("Sepal Length", "Sepal Width"))
```
## Finding Help
- All functions in R are documented
- **?** can be used to find documents
```{r}
?beeswarm
```
- **??** can be used to find something anywhere in R documents
```{r}
??beeswarm
```
# Now find more about the function **mean**
## Finding R package
- Google the problem
- Look into CRAN website www.cran.r-project.org/web/packages/
- Look into Bioconductor repo www.bioconductor.org
- **Note :** packages at Bioconductor uses different command to install that is:
```{r, eval=FALSE}
BiocManager::install("package name")
```