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)
Related Articles
Arguments (in R Functions)
Arguments (in R Functions) R function arguments are the inputs provided to a function that determine how it runs and what results it produces. Arguments are placed inside the parentheses of a function call and may represent data, options, or control ...
Observations
In research, observations—also called, cases, objects, or research units—are the entities that a study focuses on. They are the “things” about which data are collected and analyzed. Depending on the discipline and research question, observations may ...
Objects (in Research)
Objects (in Research) In research, objects—also called cases or research units—are the entities that a study focuses on. They are the “things” about which data are collected and analyzed. Depending on the discipline and research question, objects may ...
Mistake
In statistics and data science, mistakes are errors that happen because a person or system does something incorrectly when collecting, recording, entering, or processing data. Mistakes are one possible source of variation in data. Unlike ordinary ...
Cases
In research, cases—also called objects or research units—are the entities that a study focuses on. They are the “things” about which data are collected and analyzed. Depending on the discipline and research question, cases may be individuals, groups, ...