r - Creating correlation matrix p values -


this question has answer here:

i can correlation matrix using following commands:

> df<-data.frame(x=c(5,6,5,9,4,2,1,3,5,7),y=c(3.1,2.5,3.8,5.4,6.5,2.5,1.5,8.1,7.1,6.1),z=c(5,6,4,9,2,4,1,6,2,4)) > cor(df)            x         y        z x  1.0000000 0.2923939 0.6566866 y  0.2923939 1.0000000 0.1167084 z 0.6566866 0.1167084 1.0000000 > 

i can individual p-values using command:

> cor.test(x,y)$p.value [1] 0.4123234 

how can matrix of p-values these correlation coefficients? help.

you can use package hmisc.

an example of how works:

cor <- rcorr(as.matrix(data), type="pearson") 

cor$r shows correlation matrix, cor$p matrix corresponding p-values.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -