9.4 Exercise 4

In this short exercise, you will practice using the functions for data manipulation we just learned.

We will start from gtf.

If gtf it is no longer in your environment, load it with:

gtf <- read_csv("DataViz_source_files-main/files/gencode.v44.annotation.csv")
  1. Rename column chr as Chromosome. Assign to a new object.
correction
gtf2 <- rename(gtf, chromosome=chr)


2. Keep rows with “+” strand on chromosome “chr4”. Assign this filtered data to a new object.

correction
gtf3 <- filter(gtf2, strand=="+" & chromosome=="chr4")


  1. Remove columns strand and gene_type.
correction
gtf4 <- select(gtf3, -strand, -gene_type)