From a5ed339f304935c76a1d16935a5ca62755d13013 Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 16 Mar 2019 21:38:51 +0100 Subject: [PATCH] v2.2.8.1 --- DESCRIPTION | 6 +- NEWS | 8 +++ R/pophelper.R | 130 +++++++++++++++++++----------------- README.md | 2 +- inst/CITATION | 2 +- tests/testmanual/test-all.R | 3 +- vignettes/vignette.Rmd | 11 ++- 7 files changed, 89 insertions(+), 73 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ce9fe7f..95de57a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: pophelper Type: Package Title: Tabulate, analyse and visualise admixture proportions from STRUCTURE, TESS, BAPS, ADMIXTURE and tab-delimited q-matrices files -Version: 2.2.8 -Date: 2019-03-15 +Version: 2.2.8.1 +Date: 2019-03-16 Author: Roy Mathew Francis Authors@R: person("Roy", "Francis", email = "roy.m.francis@outlook.com",role = c("aut", "cre")) Maintainer: Roy Mathew Francis @@ -13,7 +13,7 @@ Description: A set of useful functions for processing admixture proportion files K using Evanno method, export clumpp files, export distruct files and generate barplots. URL: https://github.com/royfrancis/pophelper Depends: - R(>= 3.4.0), + R(>= 3.5.0), ggplot2 Imports: grid, diff --git a/NEWS b/NEWS index 4511ba1..5ab1511 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +pophelper 2.2.8.1 +=========== +* 16-Mar-2019 +* Fixed 'exportpath' issues in plotQ() +* Added 'exportpath' to plotQMultiline() and evannoMethod() +* Added 'exportpath' to tabulateQ() +* Added 'exportpath' to summariseQ() + pophelper 2.2.8 =========== * 15-Mar-2019 diff --git a/R/pophelper.R b/R/pophelper.R index 06bb28c..3a3b8fb 100644 --- a/R/pophelper.R +++ b/R/pophelper.R @@ -1,8 +1,7 @@ # Begin ------------------------------------------------------------------------ -# pophelper v2.2.8 +# pophelper v2.2.8.1 # Functions -# 15-Mar-2019 # check packages pkgs <- c("grid","gridExtra","ggplot2","gtable","tidyr") @@ -994,6 +993,9 @@ readQBaps <- function(files=NULL) #' as a tab-delimited text file in the working directory. #' @param sorttable A logical indicating if output table is to be sorted. Sorts #' table by ind and K. +#' @param exportpath A path to where content must be exported. For example, +#' \code{"./dir/anotherdir/"}. Defaults to NULL which means current working +#' directory. #' @return Returns a dataframe with filenames (if list is not named, then #' sample1, sample2 etc. is used), K and number of individuals of all runs #' sorted by ind and K (if \code{sorttable=TRUE}). The row numbers of the output @@ -1032,7 +1034,7 @@ readQBaps <- function(files=NULL) # @import xlsx #' @export #' -tabulateQ <- function(qlist=NULL,writetable=FALSE,sorttable=TRUE) +tabulateQ <- function(qlist=NULL,writetable=FALSE,sorttable=TRUE,exportpath=NULL) { # check input @@ -1114,7 +1116,7 @@ tabulateQ <- function(qlist=NULL,writetable=FALSE,sorttable=TRUE) if(sorttable) main <- main[with(main,order(ind,k)),] # write table if opted - if(writetable) write.table(main,"tabulateQ.txt",quote=FALSE,row.names=FALSE,sep="\t",dec=".") + if(writetable) write.table(main,paste0(exportpath,"tabulateQ.txt"),quote=FALSE,row.names=FALSE,sep="\t",dec=".") return(main) } @@ -1128,6 +1130,9 @@ tabulateQ <- function(qlist=NULL,writetable=FALSE,sorttable=TRUE) #' Must have minimum 2 columns named k and ind. #' @param writetable A logical indicating if the output table is to be exported #' as a tab-delimited text file in the working directory. +#' @param exportpath A path to where content must be exported. For example, +#' \code{"./dir/anotherdir/"}. Defaults to NULL which means current working +#' directory. #' @return Returns a dataframe with all values of K sorted by K. The table has #' 3 columns namely value of K, number of runs for each K and number of #' individuals. @@ -1155,7 +1160,7 @@ tabulateQ <- function(qlist=NULL,writetable=FALSE,sorttable=TRUE) #' #' @export #' -summariseQ <- summarizeQ <- function(data=NULL,writetable=FALSE) +summariseQ <- summarizeQ <- function(data=NULL,writetable=FALSE,exportpath=NULL) { # does df data contain any data? if(is.null(data) || length(data)==0) stop("summariseQ: No input files.") @@ -1185,7 +1190,7 @@ summariseQ <- summarizeQ <- function(data=NULL,writetable=FALSE) } # write table if opted - if(writetable) write.table(dframe1,"summariseQ.txt",quote=FALSE,row.names=FALSE,sep="\t",dec=".") + if(writetable) write.table(dframe1,paste0(exportpath,"summariseQ.txt"),quote=FALSE,row.names=FALSE,sep="\t",dec=".") return(dframe1) } @@ -1259,6 +1264,9 @@ summariseQ <- summarizeQ <- function(data=NULL,writetable=FALSE) #' @param quiet A logical indicating if messages must be printed to console. #' @param outputfilename A character indicating output file name. Defaults to #' 'evannoMethodStructure'. +#' @param exportpath A path to where content must be exported. For example, +#' \code{"./dir/anotherdir/"}. Defaults to NULL which means current working +#' directory. #' @return When \code{returndata=TRUE} and \code{returnplot=FALSE}, a data.frame is #' returned. #' When \code{returndata=FALSE} and \code{returnplot=TRUE}, a gtable plot object is @@ -1308,7 +1316,7 @@ evannoMethodStructure <- function(data=NULL,writetable=FALSE,exportplot=FALSE,re ebwidth=0.2,ebcol="grey30", textcol="grey30",xaxisbreaks=waiver(),xaxislabels=waiver(),basesize=6,gridsize=NA, imgtype="png",height=NA,width=NA,dpi=300,units="cm", - theme="theme_bw",font="",na.rm=TRUE,quiet=TRUE,outputfilename="evannoMethodStructure") + theme="theme_bw",font="",na.rm=TRUE,quiet=TRUE,outputfilename="evannoMethodStructure",exportpath=NULL) { # does df data contain any data? if(is.null(data) || length(data)==0) stop("evannoMethodStructure: No input files.") @@ -1405,18 +1413,18 @@ evannoMethodStructure <- function(data=NULL,writetable=FALSE,exportplot=FALSE,re if(exportplot) { # check image imgtype - if(imgtype=="pdf") pdf(paste0(outputfilename,".pdf"),height=height1,width=width1,fonts=font) - if(imgtype=="png") png(paste0(outputfilename,".png"),height=height1,width=width1,res=dpi,units=units,family=font) - if(imgtype=="jpeg") jpeg(paste0(outputfilename,".jpg"),height=height1,width=width1,res=dpi,units=units,quality=100,family=font) - if(imgtype=="tiff") tiff(paste0(outputfilename,".tiff"),height=height1,width=width1,res=dpi,units=units,compression="lzw",family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outputfilename,".pdf"),height=height1,width=width1,fonts=font) + if(imgtype=="png") png(paste0(exportpath,outputfilename,".png"),height=height1,width=width1,res=dpi,units=units,family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outputfilename,".jpg"),height=height1,width=width1,res=dpi,units=units,quality=100,family=font) + if(imgtype=="tiff") tiff(paste0(exportpath,outputfilename,".tiff"),height=height1,width=width1,res=dpi,units=units,compression="lzw",family=font) print(plist[[1]]) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outputfilename,".tiff exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outputfilename,".pdf exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outputfilename,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outputfilename,".jpg exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outputfilename,".tiff exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outputfilename,".pdf exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outputfilename,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outputfilename,".jpg exported.\n")) } } @@ -1470,8 +1478,8 @@ evannoMethodStructure <- function(data=NULL,writetable=FALSE,exportplot=FALSE,re # write table if opted if(writetable) { - write.table(data,paste0(outputfilename,".txt"),quote=FALSE,row.names=FALSE,sep="\t",dec=".") - if(!quiet) cat(paste0(outputfilename,".txt exported. \n")) + write.table(data,paste0(exportpath,outputfilename,".txt"),quote=FALSE,row.names=FALSE,sep="\t",dec=".") + if(!quiet) cat(paste0(exportpath,outputfilename,".txt exported. \n")) } # show plot @@ -1551,19 +1559,19 @@ evannoMethodStructure <- function(data=NULL,writetable=FALSE,exportplot=FALSE,re if(exportplot) { # check image imgtype - if(imgtype=="pdf") pdf(paste0(outputfilename,".pdf"),height=height1,width=width1,fonts=font) - if(imgtype =="png") png(paste0(outputfilename,".png"),height=height1,width=width1,res=dpi,units=units,family=font) - if(imgtype =="tiff") tiff(paste0(outputfilename,".tiff"),height=height1,width=width1,res=dpi,units=units,compression="lzw",family=font) - if(imgtype=="jpeg") jpeg(paste0(outputfilename,".jpg"),height=height1,width=width1,res=dpi,units=units,quality=100,family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outputfilename,".pdf"),height=height1,width=width1,fonts=font) + if(imgtype =="png") png(paste0(exportpath,outputfilename,".png"),height=height1,width=width1,res=dpi,units=units,family=font) + if(imgtype =="tiff") tiff(paste0(exportpath,outputfilename,".tiff"),height=height1,width=width1,res=dpi,units=units,compression="lzw",family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outputfilename,".jpg"),height=height1,width=width1,res=dpi,units=units,quality=100,family=font) if(plen==3) gridExtra::grid.arrange(plist[[1]],plist[[2]],plist[[3]],ncol=2,nrow=2) if(plen==4) gridExtra::grid.arrange(plist[[1]],plist[[2]],plist[[3]],plist[[4]],ncol=2,nrow=2) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outputfilename,".tiff exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outputfilename,".pdf exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outputfilename,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outputfilename,".jpg exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outputfilename,".tiff exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outputfilename,".pdf exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outputfilename,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outputfilename,".jpg exported.\n")) } if(returnplot) @@ -1579,7 +1587,6 @@ evannoMethodStructure <- function(data=NULL,writetable=FALSE,exportplot=FALSE,re if(returndata && returnplot) return(list(data=data,plot=p)) } - # clumppExport ----------------------------------------------------------------- #' @title Generate CLUMPP output from a qlist @@ -3585,16 +3592,16 @@ plotQ <- function(qlist=NULL,imgoutput="sep",clustercol=NA,sortind=NA,grplab=NA, if(exportplot) { if(!quiet) cat("Drawing plot ...\n") - if(imgtype=="tiff") tiff(paste0(outname,".tiff"),height=height1,width=width1,res=dpi,units=units1,compression="lzw",family=font) - if(imgtype=="png") png(paste0(outname,".png"),height=height1,width=width1,res=dpi,units=units1,family=font) - if(imgtype=="jpeg") jpeg(paste0(outname,".jpg"),height=height1,width=width1,res=dpi,units=units1,quality=100,family=font) - if(imgtype=="pdf") pdf(paste0(outname,".pdf"),height=height1,width=width1,fonts=font) + if(imgtype=="tiff") tiff(paste0(exportpath,outname,".tiff"),height=height1,width=width1,res=dpi,units=units1,compression="lzw",family=font) + if(imgtype=="png") png(paste0(exportpath,outname,".png"),height=height1,width=width1,res=dpi,units=units1,family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outname,".jpg"),height=height1,width=width1,res=dpi,units=units1,quality=100,family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outname,".pdf"),height=height1,width=width1,fonts=font) print(gg_plot_panel) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outname,".tiff exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outname,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outname,".jpg exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outname,".pdf exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outname,".tiff exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outname,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outname,".jpg exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outname,".pdf exported.\n")) } if(returnplot) px <- gg_plot_panel @@ -3613,16 +3620,16 @@ plotQ <- function(qlist=NULL,imgoutput="sep",clustercol=NA,sortind=NA,grplab=NA, if(exportplot) { if(!quiet) cat("Drawing plot ...\n") - if(imgtype=="tiff") tiff(paste0(outname,".tiff"),height=height1,width=width1,res=dpi,units=units1,compression="lzw",family=font) - if(imgtype=="png") png(paste0(outname,".png"),height=height1,width=width1,res=dpi,units=units1,family=font) - if(imgtype=="jpeg") jpeg(paste0(outname,".jpg"),height=height1,width=width1,res=dpi,units=units1,quality=100,family=font) - if(imgtype=="pdf") pdf(paste0(outname,".pdf"),height=height1,width=width1,fonts=font) + if(imgtype=="tiff") tiff(paste0(exportpath,outname,".tiff"),height=height1,width=width1,res=dpi,units=units1,compression="lzw",family=font) + if(imgtype=="png") png(paste0(exportpath,outname,".png"),height=height1,width=width1,res=dpi,units=units1,family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outname,".jpg"),height=height1,width=width1,res=dpi,units=units1,quality=100,family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outname,".pdf"),height=height1,width=width1,fonts=font) print(gg_plot_panel) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outname,".tiff exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outname,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outname,".jpg exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outname,".pdf exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outname,".tiff exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outname,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outname,".jpg exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outname,".pdf exported.\n")) } if(returnplot) px <- gg_plot_panel @@ -3695,18 +3702,18 @@ plotQ <- function(qlist=NULL,imgoutput="sep",clustercol=NA,sortind=NA,grplab=NA, if(exportplot) { if(!quiet) cat("Drawing plot ...\n") - if(imgtype=="tiff") tiff(paste0(outname,".tiff"),height=height2,width=width1,res=dpi,units=units1,compression="lzw",family=font) - if(imgtype=="png") png(paste0(outname,".png"),height=height2,width=width1,res=dpi,units=units1,family=font) - if(imgtype=="jpeg") jpeg(paste0(outname,".jpg"),height=height2,width=width1,res=dpi,units=units1,quality=100,family=font) - if(imgtype=="pdf") pdf(paste0(outname,".pdf"),height=height2,width=width1,fonts=font) + if(imgtype=="tiff") tiff(paste0(exportpath,outname,".tiff"),height=height2,width=width1,res=dpi,units=units1,compression="lzw",family=font) + if(imgtype=="png") png(paste0(exportpath,outname,".png"),height=height2,width=width1,res=dpi,units=units1,family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outname,".jpg"),height=height2,width=width1,res=dpi,units=units1,quality=100,family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outname,".pdf"),height=height2,width=width1,fonts=font) gridExtra::grid.arrange(ggg_plot_panel,ggg_plot_grplab,layout_matrix=matrix(c(rep(1,panelratio[1]*flen),rep(2,panelratio[2]*length(grplabloop))),ncol=1,byrow=TRUE)) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outname,".tiff exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outname,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outname,".jpg exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outname,".pdf exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outname,".tiff exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outname,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outname,".jpg exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outname,".pdf exported.\n")) } if(returnplot) px <- gridExtra::arrangeGrob(ggg_plot_panel,ggg_plot_grplab,layout_matrix=matrix(c(rep(1,panelratio[1]*flen),rep(2,panelratio[2]*length(grplabloop))),ncol=1,byrow=TRUE)) @@ -3864,6 +3871,9 @@ plotQ <- function(qlist=NULL,imgoutput="sep",clustercol=NA,sortind=NA,grplab=NA, #' returned. See 'Value'. #' @param returndata A logical indicating if processed data must be returned. #' See 'Value'. +#' @param exportpath A path to where content must be exported. For example, +#' \code{"./dir/anotherdir/"}. Defaults to NULL which means current working +#' directory. #' @return When \code{returnplot=TRUE}, plot object(s) are returned. When #' \code{grplab=NA}, a ggplot2 object is returned. When \code{returndata=TRUE}, #' the input qlist is modified (sorted, subsetted etc) and returned. If @@ -4015,7 +4025,7 @@ plotQMultiline <- function(qlist=NULL,spl=NA,lpp=NA,clustercol=NA,sortind=NA,grp showticks=FALSE,showyaxis=FALSE,ticksize=0.1,ticklength=0.03, outputfilename=NA,imgtype="png",height=NA,width=NA,dpi=300,units="cm",mar=c(0.1,0.5,0.1,0.5), theme="theme_grey",basesize=5,font="",na.rm=FALSE,quiet=FALSE, - exportplot=TRUE,returnplot=FALSE,returndata=FALSE) + exportplot=TRUE,returnplot=FALSE,returndata=FALSE,exportpath=NULL) { # check input is.qlist(qlist) @@ -4335,18 +4345,18 @@ plotQMultiline <- function(qlist=NULL,spl=NA,lpp=NA,clustercol=NA,sortind=NA,grp if(exportplot) { if(!quiet) cat("Drawing plot ...\n") - if(imgtype=="tiff") tiff(paste0(outname1,".tiff"),height=height,width=width,res=dpi,units=units,compression="lzw",family=font) - if(imgtype=="png") png(paste0(outname1,".png"),height=height,width=width,res=dpi,units=units,family=font) - if(imgtype=="jpeg") jpeg(paste0(outname1,".jpg"),height=height,width=width,res=dpi,units=units,quality=100,family=font) - if(imgtype=="pdf") pdf(paste0(outname1,".pdf"),height=height,width=width,fonts=font) + if(imgtype=="tiff") tiff(paste0(exportpath,outname1,".tiff"),height=height,width=width,res=dpi,units=units,compression="lzw",family=font) + if(imgtype=="png") png(paste0(exportpath,outname1,".png"),height=height,width=width,res=dpi,units=units,family=font) + if(imgtype=="jpeg") jpeg(paste0(exportpath,outname1,".jpg"),height=height,width=width,res=dpi,units=units,quality=100,family=font) + if(imgtype=="pdf") pdf(paste0(exportpath,outname1,".pdf"),height=height,width=width,fonts=font) do.call(gridExtra::grid.arrange,alist) dev.off() - if(imgtype=="tiff" && !quiet) cat(paste0(outname1,".tiff exported.\n")) - if(imgtype=="png" && !quiet) cat(paste0(outname1,".png exported.\n")) - if(imgtype=="jpeg" && !quiet) cat(paste0(outname1,".jpg exported.\n")) - if(imgtype=="pdf" && !quiet) cat(paste0(outname1,".pdf exported.\n")) + if(imgtype=="tiff" && !quiet) cat(paste0(exportpath,outname1,".tiff exported.\n")) + if(imgtype=="png" && !quiet) cat(paste0(exportpath,outname1,".png exported.\n")) + if(imgtype=="jpeg" && !quiet) cat(paste0(exportpath,outname1,".jpg exported.\n")) + if(imgtype=="pdf" && !quiet) cat(paste0(exportpath,outname1,".pdf exported.\n")) } if(returnplot) @@ -5060,7 +5070,7 @@ summarizeQ <- summariseQ #ON LOAD .onLoad <- function(...) { - packageStartupMessage("pophelper v2.2.8 ready.") + packageStartupMessage("pophelper v2.2.8.1 ready.") } # End -------------------------------------------------------------------------- diff --git a/README.md b/README.md index 1915fa0..5280049 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# pophelper 2.2.8 +# pophelper 2.2.8.1 `pophelper` is an R package and web app to analyse and visualise population structure. `pophelper` curently supports output run files generated from population analysis programs such as STRUCTURE, TESS, TESS3, BAPS and numeric delimited formats such as ADMIXTURE or fastSTRUCTURE. The `pophelper` package can be used to read run files to R, tabulate runs, summarise runs, estimate *K* using the Evanno method, align clusters within K using CLUMPP, export files for DISTRUCT and generate barplot figures. diff --git a/inst/CITATION b/inst/CITATION index 104f14e..04d8f43 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -10,7 +10,7 @@ bibentry(bibtype = "Article", pages = "27-32", doi = "10.1111/1755-0998.12509", url = "https://github.com/royfrancis/pophelper", - note = "pophelper R package version 2.2.8", + note = "pophelper R package version 2.2.8.1", textVersion= paste("Francis, R. M. (2017).", "pophelper: an R package and web app to analyse and visualize population structure.", diff --git a/tests/testmanual/test-all.R b/tests/testmanual/test-all.R index 43c64e5..240195c 100644 --- a/tests/testmanual/test-all.R +++ b/tests/testmanual/test-all.R @@ -1,6 +1,5 @@ # Test Script -# v2.2.8 -# 15-Mar-2018 +# v2.2.8.1 library(testthat) library(pophelper) diff --git a/vignettes/vignette.Rmd b/vignettes/vignette.Rmd index 2f27172..a071251 100644 --- a/vignettes/vignette.Rmd +++ b/vignettes/vignette.Rmd @@ -1,5 +1,5 @@ --- -title: "Pophelper 2.2.8" +title: "Pophelper 2.2.8.1" output: bookdown::html_document2: code_folding: "none" @@ -1643,7 +1643,7 @@ The argument `basesize` can be used to change text size of most text objects. Th __Exporting and returning__ -By default, when plotting, an image is exported into the working directory. This is the intended behaviour and the plot element sizes is tuned for export. Exporting can be turned off by `exportplot=FALSE`. By setting `returnplot=TRUE`, the plot object can be returned and saved as a variable for plotting later or further customisation. By setting `returndata=TRUE`, the internally processed data (qlist and grplab) can be returned to be saved to a variable. The returned object is a list and has the following structure: +By default, when plotting, an image is exported into the working directory. This is the intended behaviour and the plot element sizes is tuned for export. A location other than the current working directory can be specified using `exportpath`. Exporting can be turned off by `exportplot=FALSE`. By setting `returnplot=TRUE`, the plot object can be returned and saved as a variable for plotting later or further customisation. By setting `returndata=TRUE`, the internally processed data (qlist and grplab) can be returned to be saved to a variable. The returned object is a list and has the following structure: ``` $list @@ -2035,7 +2035,7 @@ p <- plotQMultiline(slist[1],exportplot=F,returnplot=T) print(p) ``` -The returned object is a list with slots: plot and data. The plot slot contains a gtable plot object (result from gridExtra::arrangeGrob()) and the data slot contains two slots: qlist and grplab. The qlist contains the processed qlist and the grplab contains processed group labels. In the above example, only the plot slot is filled because only `returnplot=T` was used. The data is also returned if `returndata=T` is used. +The returned object is a list with slots: plot and data. The plot slot contains a gtable plot object (result from gridExtra::arrangeGrob()) and the data slot contains two slots: qlist and grplab. The qlist contains the processed qlist and the grplab contains processed group labels. In the above example, only the plot slot is filled because only `returnplot=T` was used. The data is also returned if `returndata=T` is used. When exporting the image, a location other than the current working directory can be specified using `exportpath`. Note that this function can be slow and takes several minutes to run depending on number of individuals and number of files selected. @@ -2082,7 +2082,7 @@ A schematic data structure of a two run 'qlist' would look like below: ```{r,eval=FALSE} $list +--$list -+ +--$data.frame +| +--$data.frame +--$list +--$data.frame ``` @@ -2272,5 +2272,4 @@ The `pophelper` R package is offered free and without warranty of any kind, eith # Contact If you have any comments, suggestions or issues, report on the [Github issues page](https://github.com/royfrancis/pophelper/issues). - -__End of Document.__ +