Skip to content
Snippets Groups Projects
Commit eb9a793d authored by Gael's avatar Gael
Browse files

v10.8.0 release

parent 39131a57
No related branches found
No related tags found
No related merge requests found
......@@ -170,6 +170,15 @@ Gitlab developers
## WHAT'S NEW IN
### v10.8.0
1) fun_check() and fun_info() removed from this repo and transferred into the cute package
2) Warning: fun_check() must be conveted into cute::check() in all the functions of this repo
3) Warning: fun_info() must be conveted into cute::info() in all the functions of this repo
### v10.7.0
1) fun_gg_boxplot : name of arguments stat.disp and stat.disp.mean changed to stat.pos and stat.mean
......
This diff is collapsed.
No preview for this file type
20210616
Hello.
J'ai créé un nouveau repo:
git@gitlab.pasteur.fr:gmillot/cute.git
que vous pouvez cloner en local:
git clone git@gitlab.pasteur.fr:gmillot/cute.git
Ensuite vous pourrez travailler dessus et puis vous effectuerez des demandes de merge auprès
de moi pour que j'incorpore votre travail.
L'idée est que ce repo soit rapidement converti en package.
On peut commencer avec une seule fonction provenant de l'ancien repo de dev cute_little_r_function
et ensuite incorporer petit à petit les fonctions cleanées de cute_little_r_function
Pour demain je vois 5 axes :
1) piger le passage en package / le faire sur le repo cute et noter la procédure pour les autres
2) Piger / créer les pages web de docu
3) poursuivre les feuilles d'exemple
4) tester les fonctions et basculer sur cute
5) updater fun_gg_scatter
A voir ce qui plait à qui.
A demain
20210301
L'investissement dans le projet Cute:
1) Terminer les pages d'exemple de chaque fonction (c'est long)
2) Checker les functions existantes (les utiliser, les challenger)
......
######## fun_check() #### check class, type, length, etc., of objects
### Datasets
vec1 <- -1:3 # vector of integers
vec2 <- 1:3 / 3 # vector of proportions
vec3 <- c(1, 2, 3) # vector of integers but stored as "double"
vec4 <- "pearson" # vector of characters
vec5 <- c("a", "b","a", "b") # vector of characters
mat1 <- matrix(vec1) # matrix of integers
mat2 <- matrix(c(1:3 / 3, NA)) # matrix of proportions with NA
### Datasets info
vec1 # vector of integers
vec2 # vector of proportions
vec3 # vector of integers but stored as "double"
vec4 # vector of characters
vec5 # vector of characters
mat1 # matrix of integers
mat2 # matrix of proportions with NA
### Simple examples
# Check that vec1 is of class integer (means that it is also a vector) -> ok
fun_check(data = vec1, class = "integer")
# Check that vec1 is a numeric vector -> error because vec1 is a vector of integers
fun_check(data = vec1, class = "numeric")
# Check that vec1 is an integer vector of length 3 without negative values and without NA -> error because of length 5 and negative values inside vec1
fun_check(data = vec1, class = "vector", typeof = "integer", length = 3, neg.values = FALSE, na.contain = FALSE)
# No result displayed because the output list is assigned into res (see below the print argument)
res <- fun_check(data = vec1, class = "integer")
res
# with NULL, the function systematically report a checking problem
fun_check(data = NULL, class = "integer")
### Argument class, typeof, mode and length are the same as the corresponding R function, except class which 1) has also "vector" and 2) remains "matrix" for matrices and not "matrix" "array"
# Example
fun_check(data = vec1,
class = "vector",
typeof = "integer",
mode = "numeric",
length = 5,
)
# Warning: the function does not check for inconsistencies between arguments. It just checks if everything is ok between arguments values and data
fun_check(data = vec1,
typeof = "integer",
mode = "character", # the mode "character" exists but is inconsistant with typeof "integer". However, this aspect is not signaled by the function
)
# Error message due to wrong value in the class and length arguments
fun_check(data = vec1,
mode = "integer", # the mode "integer" does not exist in the mode() function of R
)
### Argument prop
fun_check(data = mat2,
prop = TRUE # Check for values between 0 and 1 only
)
### Argument double.as.integer.allowed
fun_check(data = vec3, typeof = "integer",
double.as.integer.allowed = TRUE # with TRUE, integers stored as double are accepted
)
### Argument options
fun_check(data = vec4,
options = c("pearson", "spearman", "kendall")
)
### Argument all.options.in.data
# No error
fun_check(data = vec5,
options = c("a", "b"),
all.options.in.data = TRUE
)
# No error
fun_check(data = vec5,
options = c("a", "b", "c"),
all.options.in.data = FALSE
)
# Error
fun_check(data = vec5,
options = c("a", "b", "c"),
all.options.in.data = TRUE
)
### Argument na.contain
fun_check(data = mat2, class = "matrix", prop = TRUE,
na.contain = FALSE # with TRUE, integers stored as double are accepted
)
### Argument neg.values
# Warning: only considered if set to FALSE, to check for non negative values when class is set to "vector", "numeric", "matrix", "array", "data.frame", "table", or typeof is set to "double", "integer", or mode is set to "numeric"
fun_check(data = mat1, class = "matrix",
neg.values = FALSE # with TRUE, integers stored as double are accepted
)
### Argument print
# No error message printed because print is FALSE
res <- fun_check(data = mat1, class = "data.frame",
print = FALSE
)
# Error message printed
res <- fun_check(data = mat1, class = "data.frame",
print = TRUE
)
# Even if print is TRUE, no error message printed because no error
res <- fun_check(data = mat1, class = "matrix",
print = TRUE
)
### Arguments data.name and fun.name
# Example
tempo <- fun_check(data = vec1, class = "integer",
data.name = "OBSERVATION_1",
fun.name = "FUNCTION_1"
)
tempo$text
# In fact, these two arguments are interesting when fun_check() is used inside functions
fun1 <- function(arg1){
tempo <- fun_check(data = arg1, class = "integer",
data.name = NULL, # if NULL, the name displayed is arg1
fun.name = NULL # if NULL, no name displayed
)
if(tempo$problem == TRUE){
cat(paste0("\n\n================\n\n", tempo$text, "\n\n================\n\n"))
}
}
fun1(arg1 = vec4) # error message because arg1 requires a vector of integers
### All the arguments
# See the examples of fun_info() to test different classes of objects
fun_check(
data = vec1,
class = "integer",
typeof = NULL,
mode = NULL,
length = NULL,
prop = FALSE,
double.as.integer.allowed = FALSE,
options = NULL,
all.options.in.data = FALSE,
na.contain = FALSE,
neg.values = TRUE,
print = FALSE,
data.name = NULL,
fun.name = NULL
)
######## fun_info() #### recover object information
### Datasets
vec1 <- -1:3 # vector of integers
vec2 <- 1:3 / 3 # vector of proportions
vec3 <- c(1, 2, NA, -Inf) # vector of integers but stored as "double", with NA and Inf
vec4 <- "pearson" # vector of characters
vec5 <- c("a", "b","a", NA) # vector of characters with NA
cpx <- as.complex(1) # complex
mat1 <- matrix(vec1) # 1D matrix of integers
mat2 <- matrix(c(1:5, NA), ncol = 2, dimnames = list(c("ROW1", "ROW2", "ROW3"), c("M1", "M2"))) # 2D matrix of floats with NA
df1 <- as.data.frame(mat2) # data.frame
l1 <- list(L1 = 1:3, L2 = letters[1:3]) # list
fac1 <- factor(rep(letters[4:6], c(4:6))) # factor
tab1 <- table(fac1) # 1D table
tab2 <- table(fac1, fac1) # 2D table
exp1 <- expression("a") # object of class "expression", mode "expression" & type "expression"
name1 <- substitute(exp1) # object of class "name", mode "name" & type "symbol"
fun1 <- mean # closure function of class "function", mode "function" & type "closure"
fun2 <- sum # primitive function of class "function", mode "function" & type "builtin"
fun3 <- get("<-") # primitive function of class "function", mode "function" & type "special"
env1 <- new.env() # environment
s4 <- show # S4 object
call1 <- call("call1") # object of class "call", mode "call" & type "language"
### Datasets info
vec1 # vector of integers
vec2 # vector of proportions
vec3 # vector of integers but stored as "double", with NA
vec4 # vector of characters
vec5 # vector of characters with NA
mat1 # 1D matrix of integers
mat2 # 2D matrix of floats with NA
df1 # data.frame
l1 # list
fac1 # factor
tab1 # 1D table
tab2 # 2D table
exp1 # object of class "expression", mode "expression" & type "expression"
name1 # object of class "name", mode "name" & type "symbol"
fun1 # closure function of class "function", mode "function" & type "closure"
fun2 # primitive function of class "function", mode "function" & type "builtin"
fun3 # primitive function of class "function", mode "function" & type "special"
env1 # environment
s4 # S4 object
call1 # object of class "call", mode "call" & type "language"
### Simple example
fun_info(data = vec1) # vector of integers
fun_info(data = vec2) # vector of proportions
fun_info(data = vec3) # vector of integers but stored as "double", with NA and Inf
fun_info(data = vec4) # vector of characters
fun_info(data = vec5) # vector of characters with NA
fun_info(data = mat1) # 1D matrix of integers
fun_info(data = mat2) # 2D matrix of floats with NA
fun_info(data = df1) # data.frame
fun_info(data = l1) # list
fun_info(data = fac1) # factor
fun_info(data = tab1) # 1D table
fun_info(data = tab2) # 2D table
fun_info(data = exp1) # object of class "expression", mode "expression" & type "expression"
fun_info(data = name1) # object of class "name", mode "name" & type "symbol"
fun_info(data = fun1) # closure function of class "function", mode "function" & type "closure"
fun_info(data = fun2) # primitive function of class "function", mode "function" & type "builtin"
fun_info(data = fun3) # primitive function of class "function", mode "function" & type "special"
fun_info(data = env1) # environment
fun_info(data = s4) # S4 object
fun_info(data = call1) # object of class "call", mode "call" & type "language"
### All the arguments
fun_info(
data = vec1,
n = 1, # number of element to display per compartment of the output list (i.e., head(..., n))
warn.print = FALSE
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment