R for Data Analysis by Mike McGrath
Author:Mike McGrath
Language: eng
Format: epub, azw3
Publisher: In Easy Steps
Published: 2018-02-03T05:00:00+00:00
A matrix in R resembles a multi-dimensional array structure found in other programming languages.
Begin an R Script by creating a vector containing a sequence of 32 integer values
data <- seq( 1:32 )
FirstMatrix.R
Next, create a matrix that stores the vector values in tabular format, then output the matrix to see the cells
table <- matrix( data, nrow=4, ncol=8 )
print( table )
Now, confirm the type of structure storing the values
cat( “\nVector?:”, is.vector( table ) ,
“\tMatrix?:”, is.matrix( table ) )
Retrieve a cell value, then assign a new value to that cell
cat( “\n\nCell 4,5 Contains:”, table[ 4, 5 ] )
table[ 4, 5 ] <- 10
Finally, search all cells for a specific value, and identify the location of cells that do contain that value
cell <- which( table == 10, arr.ind=TRUE )
cat( “\n\nValue 10 Search:\n” )
print( cell )
Run the code to see the cell values and search result
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8302)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7782)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7697)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6863)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6594)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6464)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Kotlin in Action by Dmitry Jemerov(5066)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4318)
Functional Programming in JavaScript by Mantyla Dan(4038)
Solidity Programming Essentials by Ritesh Modi(4017)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3808)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3750)
The Ultimate iOS Interview Playbook by Avi Tsadok(3725)
