Write a loop to use the function polyserial

I need to make a correlation matrix for the related selected categorical variables and numerical variables, using the function polyserial(). However, i can only call the function for two variables one time and wonder if there are any ways to write a loop that can generate the matrix for once.

df = read.csv("mydata.csv")

df2 = df %>% 

# a,b,c,d,e are the categorical variables, I like to see the correlation between them and confidence,r_med_adherence
# I can only test one by one

I think those 3 lines are equivalent to

lapply(c("a", "b", "c"), \(x){

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.