2nd Set of exercises

Pavlos Pavlidis

Introduction to R for Bioinformatics

Graduate Program 'Bioinformatics'

Exercise 1

Construct a 5 x 10 matrix A, for which every \( A_{ij} = i^j \) Hint: remember that operations are cellwise in R.

Exercise 2

Construct a 10 x 10 matrix A, for which \( A_{ij} = |i-j| \). Then extract its diagonal Hint: remember that operations are cellwise in R.

Exercise 3

Create a 10 x 10 matrix A, for which \( A_{ij} = (i-1)*10 + j \) Hint: this is the easiest, you should just try to understand how this matrix should look like.

Exercise 4

Consider the matrix of the previous exercise (3). Find a matrix B, for which \( B_{ij} = 2 \times A_{ij} \). Find a matrix C, for which \( C_{ij} = i \times j \times A_{ij} \)

Exercise 5

Create a list of 10 elements. Each element is a vector \( V_i = i, \quad i = 1 \ldots 10 \)

Exercise 6

Convert the previous list to a \( 10 \times 10 \) matrix A, by row.

Exercise 7

The same like exercise 6, by column.