Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
R for Data Science

You're reading from   R for Data Science Learn and explore the fundamentals of data science with R

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781784390860
Length 364 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Dan Toomey Dan Toomey
Author Profile Icon Dan Toomey
Dan Toomey
Arrow right icon
View More author details
Toc

Packages

In R, there are several packages that provide the correlation functionality to the programmer. We will be using the following packages in this chapter:

  • corrgram: This is the tool to graphically display correlations
  • Hmisc: This contains a variety of miscellaneous R functions
  • polycor: This contains functions to compute polychoric correlations
  • ggm: This contains functions for analyzing and fitting graphical Markov models

Correlation

Basic correlation is performed in R using the cor function. The cor function is defined as follows:

cor(x, y = NULL, 
  use = "everything", 
  method = c("pearson", "kendall", "spearman"))

The various parameters of this function are described in the following table:

Parameter

Description

x

This is the dataset.

y

This is the dataset that is compatible with x.

use

This is the optional method for computing the covariance of missing values assigned. The choices are:

  • everything
  • all.obs
  • complete.obs
  • na.or.complete
  • pairwise...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime