The cor() function will compute the covariance or correlation of x and y if these are vectors. If x and y are matrices then the covariances (or correlations) between the columns of x and the columns of y are computed.
The default method will compute the Pearson correlation coefficient (r), but you may opt to include the 'method' argument to indicate one of "pearson" (default), "kendall", or "spearman". See the link below for additional information:
Example:
# Calculate the correlation between Height and Thumb
cor(Thumb ~ Height, data = Fingers)