Commit d2b70fa4 authored by Gael's avatar Gael
Browse files

example fun_head(),fun_tail() added, fun_1d_comp() debugged

parent eba98f19
......@@ -1004,9 +1004,7 @@ fun_head <- function(
# fun_check()
# EXAMPLES
# obs1 = matrix(1:30, ncol = 5, dimnames = list(letters[1:6], LETTERS[1:5])) ; obs1 ; fun_head(obs1, 3)
# obs1 = matrix(1:30, ncol = 5, dimnames = list(letters[1:6], LETTERS[1:5])) ; obs1 ; fun_head(obs1, 3, "right")
# DEBUGGING
# data1 = matrix(1:30, ncol = 5) # for function debugging
# data1 = matrix(1:30, ncol = 5, dimnames = list(letters[1:2], LETTERS[1:5])) # for function debugging
# function name
function.name <- paste0(as.list(match.call(expand.dots = FALSE))[[1]], "()")
......@@ -1051,7 +1049,7 @@ fun_head <- function(
 
fun_tail <- function(
data1,
n = 10,
n = 6,
side = "l"
){
# AIM
......@@ -1068,10 +1066,8 @@ fun_tail <- function(
# REQUIRED FUNCTIONS FROM CUTE_LITTLE_R_FUNCTION
# fun_check()
# EXAMPLES
# obs1 = matrix(1:30, ncol = 5, dimnames = list(letters[1:6], LETTERS[1:5])) ; obs1 ; fun_tail(obs1, 3)
# obs1 = matrix(1:30, ncol = 5, dimnames = list(letters[1:6], LETTERS[1:5])) ; obs1 ; fun_tail(obs1, 3, "r")
# DEBUGGING
# data1 = matrix(1:10, ncol = 5) # for function debugging
# data1 = matrix(1:10, ncol = 5, dimnames = list(letters[1:2], LETTERS[1:5])) # for function debugging
# function name
function.name <- paste0(as.list(match.call(expand.dots = FALSE))[[1]], "()")
......@@ -1200,7 +1196,7 @@ fun_comp_1d <- function(data1, data2){
length <- NULL
same.levels <- NULL # not FALSE to deal with no factors
levels <- NULL
any.id.levels <- NULL
any.id.levels <- FALSE
same.levels.pos1 <- NULL
same.levels.pos2 <- NULL
common.levels <- NULL
......@@ -8825,7 +8821,7 @@ fun_gg_boxplot <- function(
# WARNING: (1) the string must start with "+", (2) the string must finish with ")" and (3) each function must be preceded by "ggplot2::". Example: "+ ggplot2::coord_flip() + ggplot2::theme_bw()"
# If the character string contains the "ggplot2::theme" string, then the article argument of fun_gg_boxplot() (see above) is ignored with a warning
# Handle the add argument with caution since added functions can create conflicts with the preexisting internal ggplot2 functions
# WARNING: the call of objects inside the quotes of add can lead to an error if the name of these objects are some of the fun_gg_scatter() arguments. Indeed, the function will use the internal argument instead of the global environment object. Example article <- "a" in the working environment and add = '+ ggplot2::ggtitle(article)'. The risk here is to have TRUE as title. To solve this, use add = '+ ggplot2::ggtitle(get("article", envir = .GlobalEnv))'
# WARNING: the call of objects inside the quotes of add can lead to an error if the name of these objects are some of the fun_gg_boxplot() arguments. Indeed, the function will use the internal argument instead of the global environment object. Example article <- "a" in the working environment and add = '+ ggplot2::ggtitle(article)'. The risk here is to have TRUE as title. To solve this, use add = '+ ggplot2::ggtitle(get("article", envir = .GlobalEnv))'
# return: logical. Return the graph parameters?
# return.ggplot: logical. Return the ggplot object in the output list? Ignored if return argument is FALSE. WARNING: always assign the fun_gg_boxplot() function (e.g., a <- fun_gg_boxplot()) if return.ggplot argument is TRUE, otherwise, double plotting is performed. See $ggplot in the RETURN section below for more details
# return.gtable: logical. Return the ggplot object as gtable of grobs in the output list? Ignored if plot argument is FALSE. Indeed, the graph must be plotted to get the grobs dispositions. See $gtable in the RETURN section below for more details
......@@ -10888,7 +10884,6 @@ fun_gg_boxplot <- function(
 
 
 
# add density
 
 
......@@ -13259,3 +13254,4 @@ if(return == TRUE){
 
 
 
######### fun_head() #### head of the left or right of big 2D objects
### Datasets
vec1 <- 1:100 # vector of integers
mat1 <- diag(1:20) ; dimnames(mat1) <- list(letters[1:20], LETTERS[1:20]) # diagonal matrix 20 * 20 with row names and column names
### Datasets info
vec1 # vector of integers
mat1 # diagonal matrix 20 * 20 with row names and column names
### Simple example
fun_head(data1 = vec1) # fun_head() works like head() on non 2D objects
fun_head(data1 = mat1)
### Argument n
fun_head(data1 = mat1, n = 5) # number of dimension to print (5 means 5 rows and columns)
### Argument side
fun_head(data1 = mat1, side = "r") # left or right side of the 2D object (only for matrix, data frame or table)
### All the arguments
fun_head(
data1 = mat1,
n = 6,
side = "l"
)
......@@ -4,19 +4,22 @@
######### fun_tail() #### tail of the left or right of big 2D objects
### Datasets
mat1 <- matrix(1:30, ncol = 5, dimnames = list(letters[1:6], LETTERS[1:5]))
vec1 <- 1:100 # vector of integers
mat1 <- diag(1:20) ; dimnames(mat1) <- list(letters[1:20], LETTERS[1:20]) # diagonal matrix 20 * 20 with row names and column names
### Datasets info
mat1 # matrix of integers
vec1 # vector of integers
mat1 # diagonal matrix 20 * 20 with row names and column names
### Simple example
fun_tail(data1 = vec1) # fun_tail() works like tail() on non 2D objects
fun_tail(data1 = mat1)
### Argument n
fun_tail(data1 = mat1, n = 2) # number of dimension to print (2 means 2 rows and columns)
fun_tail(data1 = mat1, n = 5) # number of dimension to print (5 means 5 rows and columns)
### Argument side
......@@ -26,7 +29,7 @@ fun_tail(data1 = mat1, side = "r") # left or right side of the 2D object (only f
### All the arguments
fun_tail(
data1 = mat1,
n = 10,
n = 6,
side = "l"
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment