These exercises cover the sections of Conditions and Loops in R Introduction to R.
– Calculate the factorial (factorial of 3 = 3 * 2 * 1) of 10 using a loop.
– Adjusting your answer from before, what is the first number that has a factorial greater than 1000.
– Using an ifelse() expression, create a factor from a vector of 1 to 40 where all numbers less than 10 are “small”,10 to 30 are “mid”,31 to 40 are “big”
– Read in all files from expression directory with .txt extension and create a table of gene expression results.
– Add annotation from Annotation.txt. How do the pathway information for genes compare between expression table and annotation table.
– Look at the correlation between samples. Do any samples show a higher degree of correlation.
– For every gene, perform a t-test and write out the t-statistic (assuming unequal variance), log2 fold change, pvalue and gene annotation to a file.