From 8e8c54be522dca80f6f925636bd2b8be10757518 Mon Sep 17 00:00:00 2001 From: Karl Broman Date: Tue, 30 Jun 2020 06:52:16 -0500 Subject: [PATCH] Revise examples to assign results to objects --- R/cbind_smother.R | 2 +- R/count_unique_geno.R | 2 +- R/encode_geno.R | 2 +- R/find_consensus_geno.R | 2 +- R/find_unique_geno.R | 2 +- R/scan_qtl_to_qtl2.R | 3 --- man/cbind_smother.Rd | 2 +- man/count_unique_geno.Rd | 2 +- man/encode_geno.Rd | 2 +- man/find_consensus_geno.Rd | 2 +- man/find_unique_geno.Rd | 2 +- man/scan_qtl_to_qtl2.Rd | 3 --- 12 files changed, 10 insertions(+), 16 deletions(-) diff --git a/R/cbind_smother.R b/R/cbind_smother.R index 2bf7d2d..27049ae 100644 --- a/R/cbind_smother.R +++ b/R/cbind_smother.R @@ -19,7 +19,7 @@ #' @examples #' df1 <- data.frame(x=c(1,2,3,NA,4), y=c(5,8,9,10,11), row.names=c("A", "B", "C", "D", "E")) #' df2 <- data.frame(z=c(7,8,0,9,10), y=c(6,NA,NA,9,10), row.names=c("A", "B", "F", "C", "D")) -#' cbind_smother(df1, df2) +#' df1n2 <- cbind_smother(df1, df2) cbind_smother <- function(mat1, mat2) { diff --git a/R/count_unique_geno.R b/R/count_unique_geno.R index 265bd94..d91dae5 100644 --- a/R/count_unique_geno.R +++ b/R/count_unique_geno.R @@ -23,7 +23,7 @@ #' c("NA", "NA", "NA", "A", "A"), #' c("A", "A", "T", "G", "G"), #' c("C", "C", "G", "G", "NA")) -#' count_unique_geno(g) +#' counts <- count_unique_geno(g) count_unique_geno <- function(genotypes, na.strings=c("N", "H", "NA", ""), cores=1) { diff --git a/R/encode_geno.R b/R/encode_geno.R index 84c92cf..05e2d4a 100644 --- a/R/encode_geno.R +++ b/R/encode_geno.R @@ -23,7 +23,7 @@ #' c("A", "A", "AT", "TA", "TT"), #' c("T", "G", NA, "GT", "TT")) #' codes <- rbind(c("C", "G"), c("A", "T"), c("T", "G")) -#' encode_geno(geno, codes) +#' geno_encoded <- encode_geno(geno, codes) #' encode_geno <- function(geno, allele_codes, output_codes=c("-", "A", "H", "B"), cores=1) diff --git a/R/find_consensus_geno.R b/R/find_consensus_geno.R index a064f93..39fbda2 100644 --- a/R/find_consensus_geno.R +++ b/R/find_consensus_geno.R @@ -24,7 +24,7 @@ #' c("C", "C", "G", "G", "A", NA, NA, NA), #' rep(NA, 8), #' c("C", "C", "G", "G", "G", "C", "G", "G")) -#' find_consensus_geno(g) +#' consensus <- find_consensus_geno(g) find_consensus_geno <- function(genotypes, na.strings=c("N", "H", "NA", ""), cores=1) { diff --git a/R/find_unique_geno.R b/R/find_unique_geno.R index d9c7354..3cd4733 100644 --- a/R/find_unique_geno.R +++ b/R/find_unique_geno.R @@ -26,7 +26,7 @@ #' c("NA", "NA", "NA", "A", "A"), #' c("A", "A", "T", "G", "G"), #' c("C", "C", "G", "G", "NA")) -#' find_unique_geno(g) +#' ug <- find_unique_geno(g) find_unique_geno <- function(genotypes, na.strings=c("N", "H", "NA", ""), cores=1) { diff --git a/R/scan_qtl_to_qtl2.R b/R/scan_qtl_to_qtl2.R index c988f4f..7c1b639 100644 --- a/R/scan_qtl_to_qtl2.R +++ b/R/scan_qtl_to_qtl2.R @@ -15,9 +15,6 @@ #' out <- scanone(hyper) #' out2 <- scan_qtl_to_qtl2(out) #' -#' library(qtl2) -#' plot(out2$scan1, out2$map) -#' #' @seealso [scan_qtl_to_qtl2()] #' #' @export diff --git a/man/cbind_smother.Rd b/man/cbind_smother.Rd index c0e93f8..d1772d3 100644 --- a/man/cbind_smother.Rd +++ b/man/cbind_smother.Rd @@ -26,5 +26,5 @@ in its place. \examples{ df1 <- data.frame(x=c(1,2,3,NA,4), y=c(5,8,9,10,11), row.names=c("A", "B", "C", "D", "E")) df2 <- data.frame(z=c(7,8,0,9,10), y=c(6,NA,NA,9,10), row.names=c("A", "B", "F", "C", "D")) -cbind_smother(df1, df2) +df1n2 <- cbind_smother(df1, df2) } diff --git a/man/count_unique_geno.Rd b/man/count_unique_geno.Rd index aed1062..40b62c4 100644 --- a/man/count_unique_geno.Rd +++ b/man/count_unique_geno.Rd @@ -28,7 +28,7 @@ g <- rbind(c("NA", "A", "A", "A", "T"), c("NA", "NA", "NA", "A", "A"), c("A", "A", "T", "G", "G"), c("C", "C", "G", "G", "NA")) -count_unique_geno(g) +counts <- count_unique_geno(g) } \seealso{ \code{\link[=find_unique_geno]{find_unique_geno()}} diff --git a/man/encode_geno.Rd b/man/encode_geno.Rd index d6b55ae..09b71bb 100644 --- a/man/encode_geno.Rd +++ b/man/encode_geno.Rd @@ -34,7 +34,7 @@ geno <- rbind(c("C", "G", "C", "GG", "CG"), c("A", "A", "AT", "TA", "TT"), c("T", "G", NA, "GT", "TT")) codes <- rbind(c("C", "G"), c("A", "T"), c("T", "G")) -encode_geno(geno, codes) +geno_encoded <- encode_geno(geno, codes) } \seealso{ diff --git a/man/find_consensus_geno.Rd b/man/find_consensus_geno.Rd index 2be61da..9d39247 100644 --- a/man/find_consensus_geno.Rd +++ b/man/find_consensus_geno.Rd @@ -29,7 +29,7 @@ g <- rbind(c("NA", "N", "A", "A", "T", "G", NA, "H"), c("C", "C", "G", "G", "A", NA, NA, NA), rep(NA, 8), c("C", "C", "G", "G", "G", "C", "G", "G")) -find_consensus_geno(g) +consensus <- find_consensus_geno(g) } \seealso{ \code{\link[=find_unique_geno]{find_unique_geno()}}, \code{\link[=encode_geno]{encode_geno()}} diff --git a/man/find_unique_geno.Rd b/man/find_unique_geno.Rd index 43a1916..601af62 100644 --- a/man/find_unique_geno.Rd +++ b/man/find_unique_geno.Rd @@ -31,7 +31,7 @@ g <- rbind(c("NA", "A", "A", "A", "T"), c("NA", "NA", "NA", "A", "A"), c("A", "A", "T", "G", "G"), c("C", "C", "G", "G", "NA")) -find_unique_geno(g) +ug <- find_unique_geno(g) } \seealso{ \code{\link[=count_unique_geno]{count_unique_geno()}}, \code{\link[=encode_geno]{encode_geno()}} diff --git a/man/scan_qtl_to_qtl2.Rd b/man/scan_qtl_to_qtl2.Rd index 258b3dc..e6fc9d5 100644 --- a/man/scan_qtl_to_qtl2.Rd +++ b/man/scan_qtl_to_qtl2.Rd @@ -24,9 +24,6 @@ hyper <- calc.genoprob(hyper, step=1, error.prob=0.002) out <- scanone(hyper) out2 <- scan_qtl_to_qtl2(out) -library(qtl2) -plot(out2$scan1, out2$map) - } \seealso{ \code{\link[=scan_qtl_to_qtl2]{scan_qtl_to_qtl2()}}