-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage-code.Rmd
104 lines (79 loc) · 2.65 KB
/
package-code.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
title: "R Notebook"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Cmd+Shift+Enter*.
```{r}
#Tutorial for making R package using devtools
#https://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html
#https://r-pkgs.org/description.html
```
```{r}
library(roxygen2)
library(devtools)
```
```{r}
#Create framework of the R package
#devtools::create("BIGr")
#Will need to edit the DESCRIPTION file with the correct information
```
```{r}
##Function to extract read count data from MADC file
```
```{r}
#Functions are added either to individual .R files, or lumped together in .R files with common theme (such as a diversity .R file with all genomic diversity analyses)
```
```{r}
#Testing the R functions
#https://r-pkgs.org/testing-basics.html
devtools::load_all()
```
```{r}
setwd("/Users/ams866/Library/CloudStorage/Box-Box/AS_Projects/Pipelines/R_packge/BIGr")
#Each time you add new documentation to your R function, you need to run devtools::document() again to re-generate the .Rd files.
devtools::document()
```
```{r}
#Making the citation file
usethis::use_citation()
```
```{r}
#Make a vignette(s) to provide examples for using the package
usethat::use_vignette("introduction")
```
```{r}
#Make the pdf manual
setwd("/Users/ams866/Library/CloudStorage/Box-Box/AS_Projects/Pipelines/R_packge/BIGr")
devtools::build_manual()
```
```{r}
#Adding needed packages to description
usethis::use_package("dplyr") # Default is "Imports"
usethis::use_package("foreach")
usethis::use_package("doParallel")
#usethis::use_package("kinship2", min_version = "1.9.6.1")
#If wanting to add specific minimum versions
# exact version
usethis::use_package("Rdpack", min_version = "0.7")
# min version = currently installed version
usethis::use_package("tidyr", min_version = TRUE)
usethis::use_package("readr", min_version = TRUE)
```
```{r}
#Test install
devtools::install_github("alex-sandercock/BIGr")
```
```{r}
#library(BIGr)
dosage2vcf(dart.report = "/Users/ams866/Library/CloudStorage/Box-Box/AS_Projects/Strawberry/Report_DSt21-8501/DSt23-8501_Allele_Dose_Report.csv",
dart.counts = "/Users/ams866/Library/CloudStorage/Box-Box/AS_Projects/Strawberry/Report_DSt21-8501/Report_DSt23-8501_Counts.csv",
ploidy=2,
output.file = "Test")
```
```{r}
install.packages("devtools") #If not already installed
library(devtools)
devtools::install_github("Breeding-Insight/BIGr")
library("BIGr")
```