These exercises are about the factors and data framessections of Introduction to R.
These exercises cover the factors and data frames sections of Introduction to R.
Exercise 1 - Factors
## [1] high low mid low mid low mid high mid high
## Levels: low < mid < high
## [1] high mid mid mid high mid high
## Levels: low < mid < high
## [1] high high veryHigh
## Levels: low < mid < high < veryHigh
Exercise 2 - Data frames
Create data frame called Annotation with a column of gene names (“Gene_1”, “Gene_2”, “Gene_3”,“Gene_4”,“Gene_5”), ensembl gene names (“Ens001”, “Ens003”, “Ens006”, “Ens007”, “Ens010”), pathway information (“Glycolysis”, “TGFb”, “Glycolysis”, “TGFb”, “Glycolysis”) and gene lengths (100, 3000, 200, 1000,1200).
Create data frame called Sample1 with ensembl gene names (“Ens001”, “Ens003”, “Ens006”, “Ens010”) and expression (1000, 3000, 10000,5000)
Create data frame called Sample2 with ensembl gene names (“Ens001”, “Ens003”, “Ens006”, “Ens007”,“Ens010”) and expression (1500, 1500, 17000,500,10000)
Create a data frame containing only those gene names common to all data frames with all information from Annotation and the expression from Sample 1 and Sample 2.
## ensembl geneNames pathway geneLengths expression.x expression.y
## 1 Ens001 Gene_1 Glycolysis 100 1000 1500
## 2 Ens003 Gene_2 TGFb 3000 3000 1500
## 3 Ens006 Gene_3 Glycolysis 200 10000 17000
## 4 Ens010 Gene_5 Glycolysis 1200 5000 10000
## ensembl geneNames pathway geneLengths expression.x expression.y
## 1 Ens001 Gene_1 Glycolysis 100 1000 1500
## 2 Ens003 Gene_2 TGFb 3000 3000 1500
## 3 Ens006 Gene_3 Glycolysis 200 10000 17000
## 4 Ens010 Gene_5 Glycolysis 1200 5000 10000
## Sample1_lne Sample2_lne
## 1 10.000000 15.000000
## 2 1.000000 0.500000
## 3 50.000000 85.000000
## 4 4.166667 8.333333
## [1] 67.5
## Gene_1 Gene_2 Gene_3 Gene_5
## 0.5849625 -1.0000000 0.7655347 1.0000000
## [1] 1500