From e5517fb03edd5664503c85c83e68c0643a036a3c Mon Sep 17 00:00:00 2001 From: Alex White Date: Tue, 28 Feb 2017 10:49:14 -0500 Subject: [PATCH 1/2] .DS_Store banished! --- data/.DS_Store | Bin 6148 -> 0 bytes vignettes/.DS_Store | Bin 6148 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 data/.DS_Store delete mode 100644 vignettes/.DS_Store diff --git a/data/.DS_Store b/data/.DS_Store deleted file mode 100644 index 9384f9df5bca33195a56035d4a8902c5ffdc766c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKu};HK3_L@JN(^-D_&xy!_NXcYGanFW%TTEhsn9)JKf9dm2O^3+T~vs~IEGd5 z7Hf1kaQB8iwyb=;+jZ;Ju3M4o4}R%>3gb#91*Cu!kOERb3jCyi_g>ocB2iHaNC7GE zsepeU3f-}(*eAxPgCRx$;)Lliu49%U7EchHihUw8G)pQmsa8h}OFHwV)-@IT#H7RG zWZtKqY;{7hIGyH1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Thu, 2 Mar 2017 13:09:05 -0500 Subject: [PATCH 2/2] Changes made to TopicMetaDiversity.R to enhance flexibility. --- R/TopicMetaDiversity.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/R/TopicMetaDiversity.R b/R/TopicMetaDiversity.R index 52306c5..bbe59a7 100644 --- a/R/TopicMetaDiversity.R +++ b/R/TopicMetaDiversity.R @@ -13,6 +13,9 @@ #' \item{\code{y2d}}{ a N-1 vector of distances between adjacent sites plotted as segments connecting the two sites} #' } #' +#' @param y2d.type The type of comparison for y2d. Function will calculate the mean and difference +#' between adjacent sites when given raw values, or will plot the simply plot the values provides +#' in y2d vector privided. Can be one of "raw", "mean", or "diff". Defaults to "diff". #' @param margin The values of the margin on the bottom, left, top and right. #' @param col.pts The color of the points for \code{annotation$y}. #' @param pch.pts The size of the points. Defaults to 20. @@ -53,6 +56,7 @@ TopicMetaDiversity = function(annotation, + y2d.type = c("diff"), margin=c(5,5,2,5), col.pts = "red3", pch.pts=20, @@ -73,6 +77,21 @@ TopicMetaDiversity = function(annotation, line.y2d=3, round_off=0, legend.pos="topleft"){ + if(y2d.type=="diff"){ + diff.mat <- t(outer(annotation$y2d, annotation$y2d, `-`)) + rownames(diff.mat) <- annotation$x_names + colnames(diff.mat) <- annotation$x_names + diff.order <- as.vector(annotation$x_names[order(annotation$y2d, annotation$x_names, decreasing =F)]) + diff.mat <- diff.mat[diff.order,diff.order] + annotation$y2d <- c(abs(split(diff.mat, (row(diff.mat) - col(diff.mat)))$"1"),0) + + } + if(y2d.type=="mean"){ + annotation$y2d<-c(((annotation$y2d[1:(length(annotation$y2d)-1)]+annotation$y2d[-1])/2),0) + } + if(y2d.type=="raw"){ + annotation$y2d<-annotation$y2d + } if(is.null(ylim)){ par(mar = margin)