Skip to Main Content
SQL Server 2017 Developer???s Guide
book

SQL Server 2017 Developer???s Guide

by Dejan Sarka, Miloš Radivojević, William Durkin
March 2018
Intermediate to advanced content levelIntermediate to advanced
816 pages
19h 35m
English
Packt Publishing
Content preview from SQL Server 2017 Developer???s Guide

Introducing data structures in R

A matrix is a two-dimensional array of values of the same type, or mode. You generate matrices from vectors with the matrix() function. Columns and rows can have labels. You can generate a matrix from a vector by rows or by columns (default). The following code shows some matrices and the difference of the generation, by rows or by columns:

x = c(1,2,3,4,5,6); x;          
Y = array(x, dim=c(2,3)); Y;    
Z = matrix(x,2,3,byrow=F); Z 
U = matrix(x,2,3,byrow=T); U;  # A matrix - fill by rows 
rnames = c("Row1", "Row2"); 
cnames = c("Col1", "Col2", "Col3"); 
V = matrix(x,2,3,byrow=T, dimnames = list(rnames, cnames)); V;   

The first line generates and shows a one-dimensional vector. The second line creates a two-dimensional array, ...

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

SQL Server 2016 Developer's Guide

SQL Server 2016 Developer's Guide

Miloš Radivojević, Dejan Sarka, William Durkin
Mastering SQL Server 2017

Mastering SQL Server 2017

Milos Radivojevic, Dejan Sarka, William Durkin, Christian Cote, Matija Lah

Publisher Resources

ISBN: 9781788476195Supplemental Content