|
3 | 3 | #' @description Generates a density grid that can then be used for heatmap or contour plots. |
4 | 4 | #' @details Invalid cells (cells with count < to the set filter value for the minimum allowed |
5 | 5 | #' counts in table cells) are turn to 0. |
6 | | -#' @param xvect a numerical vector |
7 | | -#' @param yvect a numerical vector |
| 6 | +#' @param x a character string providing the name of a server-side numerical vector |
| 7 | +#' @param y a character string providing the name of a server-side numerical vector |
8 | 8 | #' @param limits a logical expression for whether or not limits of the density grid are defined by |
9 | | -#' a user. If \code{limits} is set to "FALSE", min and max of xvect and yvect are used as a range. |
| 9 | +#' a user. If \code{limits} is set to "FALSE", min and max of x and y are used as a range. |
10 | 10 | #' If \code{limits} is set to "TRUE", limits defined by x.min, x.max, y.min and y.max are used. |
11 | 11 | #' @param x.min a minimum value for the x axis of the grid density object, if needed |
12 | 12 | #' @param x.max a maximum value for the x axis of the grid density object, if needed |
13 | 13 | #' @param y.min a minimum value for the y axis of the grid density object, if needed |
14 | 14 | #' @param y.max a maximum value for the y axis of the grid density object, if needed |
15 | 15 | #' @param numints a number of intervals for the grid density object, by default is 20 |
16 | | -#' @return a grid density matrix |
| 16 | +#' @return a list with the grid density matrix (\code{grid}) and the classes of the x and y inputs |
| 17 | +#' (\code{class.x} and \code{class.y}) |
17 | 18 | #' @author Julia Isaeva, Amadou Gaye, Demetris Avraam for DataSHIELD Development Team |
| 19 | +#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands |
18 | 20 | #' @export |
19 | | -#' |
20 | | -densityGridDS <- function(xvect, yvect, limits=FALSE, x.min=NULL, x.max=NULL, y.min=NULL, y.max=NULL, numints=20){ |
21 | | - |
| 21 | +#' |
| 22 | +densityGridDS <- function(x, y, limits=FALSE, x.min=NULL, x.max=NULL, y.min=NULL, y.max=NULL, numints=20){ |
| 23 | + |
| 24 | + xvect <- .loadServersideObject(x) |
| 25 | + yvect <- .loadServersideObject(y) |
| 26 | + .checkClass(obj = xvect, obj_name = x, permitted_classes = c("numeric", "integer")) |
| 27 | + .checkClass(obj = yvect, obj_name = y, permitted_classes = c("numeric", "integer")) |
| 28 | + |
22 | 29 | ############################################################# |
23 | | - # MODULE 1: CAPTURE THE nfilter SETTINGS |
| 30 | + # MODULE 1: CAPTURE THE nfilter SETTINGS |
24 | 31 | thr <- dsBase::listDisclosureSettingsDS() |
25 | 32 | nfilter.tab <- as.numeric(thr$nfilter.tab) |
26 | 33 | #nfilter.glm <- as.numeric(thr$nfilter.glm) |
@@ -93,9 +100,9 @@ densityGridDS <- function(xvect, yvect, limits=FALSE, x.min=NULL, x.max=NULL, y |
93 | 100 |
|
94 | 101 | names(dimnames(grid.density.obj))[2] <- title.text |
95 | 102 | names(dimnames(grid.density.obj))[1] <- '' |
96 | | - |
97 | | - return(grid.density.obj) |
98 | | - |
| 103 | + |
| 104 | + return(list(grid=grid.density.obj, class.x=class(xvect), class.y=class(yvect))) |
| 105 | + |
99 | 106 | } |
100 | 107 | # AGGREGATE FUNCTION |
101 | 108 | # densityGridDS |
0 commit comments