0
I have a data.frame with several columns with different data, integers, numbers, character and factor.
I need to perform a correlation matrix with this data, but R can only perform the correlation with numerical data(int and Dbl).
I would like to separate only the numerical data(int and Dbl) to make the correlation. how could I do this?
example of my data.
j<-c(1,2,3,4,5,6,7,8,9,10)
k<-c(50,2,042,3658,14,3586,324,24,352,217)
y<-c('aaa','bbb','ccc','ccc','ddd','eee','eee','bbb','aaa','aaa')
x<-c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE)
z<-c("segunda","terça","quarta","segunda","sexta","quinta","quinta","sexta","quarta","terça")#fator
df<-data.frame(g,j,k,y,x,z)
view(df)
Hello @Marcus Nunes I tested the command here and it worked for the whole example. But I had a problem applying in my real df. I know I didn’t specify it in the question, but I have a "list" class column which is an a sf() of a state polygon. The results were only with the columns "Numeric" and "list". I tried applying the select(- ) command in the list column and other web tips, but it did not resolve. Finally I still can not make the correlation because of this list. I can edit the question or open a new?
– wesleysc352
I recommend opening a new question as the original question has been answered.
– Marcus Nunes