I’m not sure how familiar folks are with the Bioconductor ">Biobase" datasets but one of the free datasets is called ALL (Acute lymphoblastic leukemia). My goal is to calculate and visualize some basic properties of gene expression levels from the ALL dataset.  I’m getting stuck on how to write a line of code that's specifically for patients, and another just for genes.  I understand that rows=genes and columns=patients, but I do not have the syntax down to specify patients and genes.  For example, I have tried:

    > hist(exprs(ALL))
And

    > median(exprs(ALL))

    [1] 5.469092 

I’m not happy with the results and I know I’m doing something wrong, for example…

    > hist(exprs(ALL)) 

…will not calculate the average gene expression levels for each gene.
and…

    > median(exprs(ALL))

…will not find the average gene expression per gene.  **Any guidance is super appreciated!** 

I second ATpoint -- sounds like you need to familiarize yourself with how a matrix is interpreted in R, which is what `exprs(ALL)` returns.

A matrix is a vector with assigned dimensions, here these dimensions happen to be 2 (rows, columns).
So, when you call `median(matrix)`, it will simply take the median of all values within the matrix, ignoring the fact that it has rows and columns. If you want patient- and gene-specific values, you will have to specify that you want the values to be calculated on the rows (for genes) or columns (for patients), as ATpoint has shown.

Here's a toy example to illustrate the point:

```
> test_mat <- matrix(c(rep(1,5), 1:5,1:5), nrow = 5)
> test_mat
     [,1] [,2] [,3]
[1,]    1    1    1
[2,]    1    2    2
[3,]    1    3    3
[4,]    1    4    4
[5,]    1    5    5

# median of all values
> median(test_mat)
[1] 2

# median for the values of the second column
> median(test_mat[,2])
[1] 3

# median for the values of the fifth row
> median(test_mat[5,])
[1] 5

# median calculated for every row 
> apply(test_mat, 1, median)
[1] 1 2 3 4 5

# median calculated for every column
> apply(test_mat, 2, median)
[1] 1 3 3
```