#' @param y A vector with numerical values or a named list will be mapped to the y-axis. In case of a named list, a dropdown menu will be provided in the interactive mode. Note: The length of vectors x and y should be the same as well as the length of all vectors in case of a named list.
#' @param colour_by (Optional) A vector with factorial values or a named list will be used for colouring. In case of a named list, a dropdown menu will be provided in the interactive mode. Note: The length of the vector should be of the same length as x and y as well as the length of all vectors in case of a named list.
#' @param labels (Optional) A vector or list with sample names (numeric or characters). A dropdown menu for colouring by label will be provided. Note: The length of the vector should be of the same length as x and y.
#' @param expression (Optional) A matrix or dataframe with the same length of columns as 'x'. The sequence of the columns should be equal to the sequence in 'x'. The rownames represent the feature i.e. gene names and the values represent the expression level.
#' @param title (Optional) The title of the components junk.
#'
#' @return A string containing markdown code for the rendered textbox
if(!all(sapply(x,is.numeric)))stop("x should only contain numerical values.")
if(!all(sapply(y,is.numeric)))stop("y should only contain numerical values.")
if(!all(sapply(x,is.numeric)))stop("'x' should only contain numerical values.")
if(!all(sapply(y,is.numeric)))stop("'y' should only contain numerical values.")
if((!is.matrix(expression)&!is.data.frame(expression))&!is.null(expression))stop("'expression' should be a class of 'matrix' or 'data.frame'.")
# Check, if lengths in a list are the same and if x and y and label and color_by are the same length
if(length(unique(sapply(x,length)))!=1)stop("The list x should contain elements with the same length.")
if(length(unique(sapply(y,length)))!=1)stop("The list y should contain elements with the same length.")
if(length(unique(sapply(colour_by,length)))!=1&!is.null(colour_by))stop("The list colour_by should contain elements with the same length.")
if(length(unique(sapply(labels,length)))!=1&!is.null(labels))stop("The list labels should contain elements with the same length.")
if(length(unique(sapply(x,length)))!=1)stop("The list 'x' should contain elements with the same length.")
if(length(unique(sapply(y,length)))!=1)stop("The list 'y' should contain elements with the same length.")
if(length(unique(sapply(colour_by,length)))!=1&!is.null(colour_by))stop("The list 'colour_by' should contain elements with the same length.")
if(length(unique(sapply(labels,length)))!=1&!is.null(labels))stop("The list 'labels' should contain elements with the same length.")
if(!identical(length(x[[1]]),length(y[[1]])))stop("All arguments should be of the the same length.")
if(!identical(length(x[[1]]),length(colour_by[[1]]))&!is.null(colour_by))stop("All arguments should be of the the same length.")
if(!identical(length(x[[1]]),length(labels[[1]]))&!is.null(labels))stop("All arguments should be of the the same length.")
if(!identical(ncol(expression),length(x[[1]]))&!is.null(expression))stop("The number of columns in 'expression' should be equal to the length of the vector 'x'.")
# Create component environment
env<-new.env()
...
...
@@ -51,6 +54,8 @@ scatterplot <- function(object, x, y, colour_by = NULL, labels = NULL, title = N
\item{labels}{(Optional) A vector or list with sample names (numeric or characters). A dropdown menu for colouring by label will be provided. Note: The length of the vector should be of the same length as x and y.}
\item{expression}{(Optional) A matrix or dataframe with the same length of columns as 'x'. The sequence of the columns should be equal to the sequence in 'x'. The rownames represent the feature i.e. gene names and the values represent the expression level.}
\item{title}{(Optional) The title of the components junk.}