Skip to Content
Modern R Programming Cookbook
book

Modern R Programming Cookbook

by Jaynal Abedin
October 2017
Beginner to intermediate
236 pages
7h 38m
English
Packt Publishing
Content preview from Modern R Programming Cookbook

How it works…

Since the dataset was in a CSV file, after reading it into the R environment, it got stored as a data frame. In this recipe, you will use the matrix operation, so you need to convert the data frame into a matrix. That’s why, in the Getting ready section, the data frame has been converted into a matrix using the as.matrix() function.

In the next step, two functions were written, one using a for loop to calculate the frequency of each column in the dataset and also all possible pair-wise frequencies, and the other function also did the same task but it was implemented without using any loop. The second function uses a certain logic to calculate the frequency and cross-frequency, that is, if all of the variables in a dataset are ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor

Publisher Resources

ISBN: 9781787129054Supplemental Content