---
title: "R-Intro Worksheet"
author: "Manpreet S. Katari"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

Download the markdown here: [R-IntroExercise.Rmd](https://kataridocs.bio.nyu.edu/lectures/R-Intro/Worksheets/R-IntroExercise.Rmd)

### Q1: Create a matrix (call it transcriptome) with the values below. The experiments are column names and genes are the row names.

_Note: use a matrix object for now, don't worry about trying to create a data frame with factors. We will go over this again next week._

 .        | Control | Nitrogen | Phosphate | Potassium
---------|---------|----------|-----------|-----------
GeneA    |   89    |    78    |     77    |    56
GeneB    |   90    |    99    |     85    |    97
GeneC    |   78    |    94    |     99    |    87
GeneD    |   81    |    83    |     80    |    79

```{r}

```


### Q2: Use an R function to calculate the average expression for all genes and save it in a vector called ``expression_average``.

_Hint: Remember that you can always get help with commands by typing `?commandname`, `apropos("commandname")`, and `example("commandname")`._

```{r}


```


### Q3: Add the expression_average vector as another column to the transcriptome matrix

_Hint: You can use cbind to combine a matrix and a vector_

```{r}

```


### Q4: Sort the matrix such that the gene with the highest average gene expression is on top.

_Hint: the **sort()** function sorts the data and the **order()** function provides how to order the data to be sorted._

```{r}


```









