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…

The set.seed() function has been used to make the example reproducible. The matrix mat contains five columns and 10 rows representing the binary variable of each disease. The rownames() and colnames() functions have been used to give the name of the rows and columns for easy understanding.

Initially, the output matrix out is created with all NA values. The number of columns of the out matrix will be the total number of columns in the original input matrix, and the number of rows of the out matrix will be the same as the number of columns of the original input matrix.

To get all possible combinations, the first loop runs from one to a number of columns and the second loop also runs from one to a number of columns. These two loops ...

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