Lesson 2 Exercise Questions: Part 1 (BaseR subsetting and Factors)
The filtlowabund_scaledcounts_airways.txt includes normalized and non-normalized transcript count data from an RNAseq experiment. You can read more about the experiment here.
We are going to use the filtlowabund_scaledcounts_airways.txt file for this exericise. Get the data here
Putting what we have learned to the test:
The following questions synthesize several of the skills you have learned thus far. It may not be immediately apparent how you would go about answering these questions. Remember, the R community is expansive, and there are a number of ways to get help including but not limited to google search. These questions have multiple solutions, but you should try to stick to the tools you have learned to use thus far.
-
Import the filtlowabund_scaledcounts_airways.txt into R and save to an R object named transcript_counts. Try not to use the dropdown menu for loading the data.
-
What are the dimensions of transcript_counts?
-
What are the column names?
-
Is there a difference in the number of transcripts with greater than 0 normalized counts per sample? What commands did you use to answer this question.
-
How many categories of transcripts are there? Think about what you know regarding factors.
-
How many categories of transcripts are there when only considering transcripts with greater than 0 normalized counts per sample? (See question 5)
-
Subset transcript_counts to only include the following columns: sample, cell, dex, transcript, avgLength, counts_scaled. Save this new dataframe to a new object called transc_df.
-
Using your new data frame from question seven (transc_df), rename the column "sample" to "Sample".
-
What is the mean and standard deviation of "avgLength" across the entire transc_df data frame? Hint: Read the help documentation for mean() and sd().
-
Make a data frame with the column names "Mean" and "Standard Dev" that holds the values from question 9. Hint: check out the function data.frame().