Simple bivariate correlation

cor() is used to compute correlations and cov() covariances. The share the same arguments.

cor(world[,2:10])Compute a correlation matrix (numerical data matrix or frame=
cor(urb,infmor) Compute correlation between two varuables
>cor(urb,infmor, method="spearman")Compute the spearmand coeefficient, default is "pearson"; "kendall" is the third available method
cor(world[,2:10], na.rm=TRUE)Remove missing values

See help(cor)> for various use options to control missing data handling.

Partial and semipartial (part) correlation


spcor(world[,2:4])Semipartial correlation of a matrix or frame
pcor(world[,2:4])Partial correlation of a matrix or frame
pcor(world[,c("infmor","urb","lit")])using column (variable) names
pcor(world[,2:4], method="kendall")use "kendall" instead of default "pearson", other possibility: "spearman"
Related commands