7.3 from Excel
{tidyverse} provides the {readxl} package with functions to read in Excel files.
Although working with text files (.txt, .csv, .tsv etc.) is a better practice, you can import Excel files using the read_excel() function.
First, load the {readxl} package (bottom-right panel -> Packages -> search and tick readxl, or from the console, as shown below).
## # A tibble: 20 × 4
## Gene DE sample1 sample2
## <chr> <chr> <dbl> <dbl>
## 1 DKK1 No 9.06 5.27
## 2 TP53 No 3.57 8.55
## 3 BRCA1 No 7.39 8.24
## 4 AKT3 Down 15.1 1.57
## 5 CCND1 No 6.74 10.1
## 6 AXL No 13.5 16.6
## 7 STAT3 Down 15.2 5.46
## 8 CCL1 No 5.28 7.09
## 9 TRAF2 No 8.93 12.9
## 10 IL1R No 8.46 15.3
## 11 TAB2 No 9.76 14.6
## 12 HPK1 Down 14.1 7.34
## 13 TLR8 Up 2.69 16.3
## 14 TGFB No 7.83 12.5
## 15 STAT5 Down 18.6 9.21
## 16 ADAM17 Down 16.1 10.3
## 17 PTEN Up 0.0210 11.2
## 18 SMRT No 11.7 16.9
## 19 DVL No 4.33 6.84
## 20 MAPK2 Up 0.998 9.56
If the Excel file contains multiple sheets, you can specify the name of the sheet using the sheet= parameter:
## # A tibble: 20 × 4
## Gene DE sample1 sample2
## <chr> <chr> <dbl> <dbl>
## 1 DKK1 No 9.06 5.27
## 2 TP53 No 3.57 8.55
## 3 BRCA1 No 7.39 8.24
## 4 AKT3 Down 15.1 1.57
## 5 CCND1 No 6.74 10.1
## 6 AXL No 13.5 16.6
## 7 STAT3 Down 15.2 5.46
## 8 CCL1 No 5.28 7.09
## 9 TRAF2 No 8.93 12.9
## 10 IL1R No 8.46 15.3
## 11 TAB2 No 9.76 14.6
## 12 HPK1 Down 14.1 7.34
## 13 TLR8 Up 2.69 16.3
## 14 TGFB No 7.83 12.5
## 15 STAT5 Down 18.6 9.21
## 16 ADAM17 Down 16.1 10.3
## 17 PTEN Up 0.0210 11.2
## 18 SMRT No 11.7 16.9
## 19 DVL No 4.33 6.84
## 20 MAPK2 Up 0.998 9.56