**Exercise 1**

Create an array (3 dimensional) of 24 elements using the `dim()`

function.

**Exercise 2**

Create an array (3 dimensional) of 24 elements using the `array()`

function.

**Exercise 3**

Assign some dimnames of your choice to the array using the `dimnames()`

function.

**Exercise 4**

Assign some dimnames of your choice to the array using the arguments of the `array()`

function.

**Exercise 5**

Instead of column-major array, make a row-major array (transpose).

**Exercise 6**

For this exercise, and all that follow, download this file, and read it into R using the `read.csv()`

function, e.g.:

`temp`

Copy the column named `N`

into a new variable `arr`

.

**Exercise 7**

Set dimensions of this variable and convert it into a 3 * 2 * 4 array. Add dimnames.

**Exercise 8**

Print the whole array on the screen.

**Exercise 9**

Print only elements of height 2, assuming the first dimension represents rows, the second columns and the third heigth.

**Exercise 10**

Print elements of height 1 and columns 3 and 1.

**Exercise 11**

Print element of height 2, column 4 and row 2.

**Exercise 12**

Repeat the exercises 9-11, but instead of using numbers to reference row, column and height, use `dimnames`

.

Image: Cubo completato” by Masakazu “Matto” Matsumoto from Nagoya, Japan – http://flickr.com/photos/vitroids/1527092739/. Licensed under CC BY 2.0 via Wikimedia Commons.

**What's next:**

- Explore all our (>1000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below

kd says

Would be nice to have solutions to this exercises as well.

Jon says

Clarification needed for Exercise #7 onwards.

My multi-dimentional array has the dimensions 3*2*4, which I assume corresponds to row*column*height as per E#9. Therefore E#10 and E#11 don’t work, since your number of columns is 2.

Please let me know if I’m misinterpreting this. Thanks!

ted says

I like the structure, exercises, and the solutions for validation. I wish if you have a link for array exercise solution

prashanth says

hello

could you please provide solutions for this exercise. i am stuck with questions 9-12

Kung Fury says

Shared my own solutions in rpubs: http://rpubs.com/onurhan/r-exercises-4-2 . please share your comments!