Hello,
To calculate correlation you must supply numeric vectors of the same length. However, you can search for documentation of the function cor.test(). You can find the first argument in the documentation as follows (to calculate the correlation between x and y).
Arguments
x, y : numeric vectors of data values. x and y must have the same length. #-----------------------
Two of the columns sol and porte.greffe in your etude data are character vectors not numeric. you must remove them before applying cor.test() or other functions that uses cor.test()in the backend. You can do simply;
# For few columns
etude_num <- etude[, !colnames(etude) %in% c("sol", "porte.greffe")]
# For more general case with numbers of columns
library(tidyverse)
etude_num <- edute %>%
dplyr::select_if(is.numeric)
# Finally apply your desire functions
corrigraph(etude_num, mu = TRUE, prop = TRUE)
> # For few columns
> etude_num <- etude[, !colnames(etude) %in% c("sol", "porte.greffe")]
> # For more general case with numbers of columns
> library(tidyverse)
> etude_num <- edute %>%
+ dplyr::select_if(is.numeric)
Error in tbl_vars_dispatch(x) : object 'edute' not found
> etude_num <- etude %>%
+ dplyr::select_if(is.numeric)
> # Finally apply your desire functions
> corrigraph(etude_num, mu = TRUE, prop = TRUE)
cor calculation
==================================================
============Error in cor.test.default(data[, i], data[, j], na.rm = T) :
'x' doit être un vecteur numérique
> # For few columns
> etude_num <- etude[, !colnames(etude) %in% c("sol", "porte.greffe")]
> # For more general case with numbers of columns
> library(tidyverse)
> etude_num <- etude %>%
+ dplyr::select_if(is.numeric)
> # Finally apply your desire functions
> corrigraph(etude_num, mu = TRUE, prop = TRUE)
cor calculation
==================================================
============Error in cor.test.default(data[, i], data[, j], na.rm = T) :
'x' doit être un vecteur numérique
So once again it says that x must be a numeric vector. But when I see the data, everything is numeric..
Hi,
sorry for being delay to reply. please load the data first
Look at the first error message: Error in tbl_vars_dispatch(x) : object 'edute' not found.
There is no data named etude in your current environment.