Error in `contrib.url(repos, "source")`: trying to use CRAN without setting a mirror

# if not installed, install tidyverse and Hmisc
if (!require(package, character.only = TRUE)) {
# Call the function to check and install packages
select(-plot_year, -gn_code, -plot, -year, -cell, -block, -XX, -YY, -treatment) %>%
cor_list_rcorr <- rcorr(as.matrix(com_table_p4)) # of package Hmisc
cor_matrix <- cor_list_rcorr$r # for rcorr function of Hmisc
# Calculate coupling using the eco_coupling function:
coup_new <- eco_coupling(cor_matrix, data_str = "matrix")
# Calculate coupling by manipulating the correlation matrix manually:
matrix_test[!upper.tri(matrix_test, diag = FALSE)] <- NA
coup_old  <- mean(as.matrix(abs(matrix_test)), na.rm = TRUE)