Array in R


Arrays can be of any number of dimensions opposed to matrix which is limited to  two dimensional. The array function takes a dim attribute which creates the required number of dimension.





# Command Prototype
Command:: a <- array(c('vegetable','Fruits'),dim = c(3,3,2))
> print(a)

, , 1

     [,1]        [,2]        [,3]      
[1,] "vegetable" "Fruits"    "vegetable"
[2,] "Fruits"    "vegetable" "Fruits"  
[3,] "vegetable" "Fruits"    "vegetable"

, , 2

     [,1]        [,2]        [,3]      
[1,] "Fruits"    "vegetable" "Fruits"  
[2,] "vegetable" "Fruits"    "vegetable"
[3,] "Fruits"    "vegetable" "Fruits"

Array in R Reviewed by Rupesh on 00:10 Rating: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.