Go back to the main page
Go back to the R overview page
R
Data Analysis Exercises
Import Tidyverse:
The following function is used to print tibbles in a proper way for the web. You can skip the use of this function to print tibbles to your screen in R Markdown documents.
library(knitr)
library(kableExtra)
library(pillar)
formatted_table <- function(df) {
col_types <- sapply(df, pillar::type_sum)
new_col_names <- paste0(names(df), "<br>", "<span style='font-weight: normal;'>", col_types, "</span>")
kbl(df,
col.names = new_col_names,
escape = FALSE, # This is crucial to allow the <br> tag to work
format = "html" # Ensure HTML format, although often auto-detected
) %>%
kable_styling(bootstrap_options = c("striped", "hover", "responsive"))
}This file can be downloaded here
In order to compare the analysis in R with Excel, the exercises where kept as similar as possible.
Exercise 1
Import the Mice Protein Expression dataset in R. It contains data on the levels of protein expression of mice proteins in different mice. Perform the following calculations on this data frame and display them as a table:
- Calculate the minimum, maximum, average, median from the columns
CDK5_NandTau_N. Display the answers in a data frame.
file_path <- "./files_10_data_analysis_exercises/exercise01/Data_Cortex_Nuclear.csv"
df <- read_csv(file_path)
formatted_table(head(df))|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 309_1 | 0.5036439 | 0.7471932 | 0.4301753 | 2.816329 | 5.990152 | 0.2188300 | 0.1775655 | 2.373744 | 0.2322238 | 1.750936 | 0.6879062 | 0.3063817 | 0.4026984 | 0.2969273 | 1.0220603 | 0.6056726 | 1.877684 | 2.308745 | 0.4415994 | 0.8593658 | 0.4162891 | 0.3696080 | 0.1789443 | 1.866358 | 3.685247 | 1.537227 | 0.2645263 | 0.3196770 | 0.8138665 | 0.1658460 | 0.4539098 | 3.037621 | 0.3695096 | 0.4585385 | 0.3353358 | 0.8251920 | 0.5769155 | 0.4480993 | 0.5862714 | 0.3947213 | 0.3395706 | 0.4828639 | 0.2941698 | 0.1821505 | 0.8427252 | 0.1926084 | 1.443091 | 0.2947000 | 0.3546045 | 1.339070 | 0.1701188 | 0.1591024 | 0.1888517 | 0.1063052 | 0.1449893 | 0.1766677 | 0.1251904 | 0.1152909 | 0.2280435 | 0.1427556 | 0.4309575 | 0.2475378 | 1.603310 | 2.014875 | 0.1082343 | 1.0449792 | 0.8315565 | 0.1888517 | 0.1226520 | NA | 0.1063052 | 0.1083359 | 0.4270992 | 0.1147832 | 0.1317900 | 0.1281856 | 1.675652 | Control | Memantine | C/S | c-CS-m |
| 309_2 | 0.5146171 | 0.6890635 | 0.4117703 | 2.789514 | 5.685038 | 0.2116362 | 0.1728170 | 2.292150 | 0.2269721 | 1.596377 | 0.6950062 | 0.2990511 | 0.3859868 | 0.2813189 | 0.9566759 | 0.5875587 | 1.725774 | 2.043036 | 0.4452219 | 0.8346593 | 0.4003642 | 0.3561775 | 0.1736797 | 1.761047 | 3.485287 | 1.509249 | 0.2557270 | 0.3044187 | 0.7805042 | 0.1571935 | 0.4309403 | 2.921883 | 0.3422793 | 0.4235599 | 0.3248347 | 0.7617176 | 0.5450973 | 0.4208761 | 0.5450973 | 0.3682546 | 0.3219592 | 0.4545193 | 0.2764306 | 0.1820863 | 0.8476146 | 0.1948153 | 1.439460 | 0.2940598 | 0.3545483 | 1.306323 | 0.1714271 | 0.1581289 | 0.1845700 | 0.1065922 | 0.1504709 | 0.1783090 | 0.1342751 | 0.1182345 | 0.2380731 | 0.1420366 | 0.4571562 | 0.2576322 | 1.671738 | 2.004605 | 0.1097485 | 1.0098831 | 0.8492704 | 0.2004036 | 0.1166822 | NA | 0.1065922 | 0.1043154 | 0.4415813 | 0.1119735 | 0.1351030 | 0.1311187 | 1.743610 | Control | Memantine | C/S | c-CS-m |
| 309_3 | 0.5091831 | 0.7302468 | 0.4183088 | 2.687201 | 5.622058 | 0.2090109 | 0.1757222 | 2.283336 | 0.2302468 | 1.561316 | 0.6773484 | 0.2912761 | 0.3810025 | 0.2817103 | 1.0036350 | 0.6024488 | 1.731873 | 2.017984 | 0.4676679 | 0.8143294 | 0.3998469 | 0.3680888 | 0.1739047 | 1.765544 | 3.571456 | 1.501243 | 0.2596135 | 0.3117467 | 0.7851540 | 0.1608954 | 0.4231873 | 2.944136 | 0.3436962 | 0.4250048 | 0.3248517 | 0.7570308 | 0.5436197 | 0.4046298 | 0.5529941 | 0.3638799 | 0.3130859 | 0.4471972 | 0.2566482 | 0.1843877 | 0.8561658 | 0.2007373 | 1.524364 | 0.3018807 | 0.3860868 | 1.279600 | 0.1854563 | 0.1486963 | 0.1905322 | 0.1083031 | 0.1453302 | 0.1762129 | 0.1325604 | 0.1177602 | 0.2448173 | 0.1424450 | 0.5104723 | 0.2553430 | 1.663550 | 2.016831 | 0.1081962 | 0.9968476 | 0.8467087 | 0.1936845 | 0.1185082 | NA | 0.1083031 | 0.1062193 | 0.4357769 | 0.1118829 | 0.1333618 | 0.1274311 | 1.926427 | Control | Memantine | C/S | c-CS-m |
| 309_4 | 0.4421067 | 0.6170762 | 0.3586263 | 2.466947 | 4.979503 | 0.2228858 | 0.1764626 | 2.152301 | 0.2070042 | 1.595086 | 0.5832768 | 0.2967287 | 0.3770870 | 0.3138320 | 0.8753903 | 0.5202932 | 1.566852 | 2.132754 | 0.4776707 | 0.7277046 | 0.3856387 | 0.3629700 | 0.1794489 | 1.286277 | 2.970137 | 1.419709 | 0.2595358 | 0.2792181 | 0.7344917 | 0.1622099 | 0.4106149 | 2.500204 | 0.3445093 | 0.4292113 | 0.3301208 | 0.7469798 | 0.5467626 | 0.3868603 | 0.5478485 | 0.3667707 | 0.3284919 | 0.4426497 | 0.3985340 | 0.1617677 | 0.7602335 | 0.1841694 | 1.612382 | 0.2963818 | 0.2906795 | 1.198765 | 0.1597991 | 0.1661123 | 0.1853235 | 0.1031838 | 0.1406558 | 0.1638042 | 0.1232096 | 0.1174394 | 0.2349467 | 0.1450682 | 0.4309959 | 0.2511031 | 1.484624 | 1.957233 | 0.1198832 | 0.9902247 | 0.8332768 | 0.1921119 | 0.1327812 | NA | 0.1031838 | 0.1112620 | 0.3916910 | 0.1304053 | 0.1474442 | 0.1469011 | 1.700563 | Control | Memantine | C/S | c-CS-m |
| 309_5 | 0.4349402 | 0.6174298 | 0.3588022 | 2.365785 | 4.718679 | 0.2131059 | 0.1736270 | 2.134014 | 0.1921579 | 1.504230 | 0.5509601 | 0.2869612 | 0.3635021 | 0.2779643 | 0.8649120 | 0.5079898 | 1.480059 | 2.013697 | 0.4834161 | 0.6877937 | 0.3675305 | 0.3553109 | 0.1748355 | 1.324695 | 2.896334 | 1.359876 | 0.2507050 | 0.2736672 | 0.7026991 | 0.1548274 | 0.3985498 | 2.456560 | 0.3291258 | 0.4087552 | 0.3134148 | 0.6919565 | 0.5368605 | 0.3608164 | 0.5128240 | 0.3515510 | 0.3122063 | 0.4190949 | 0.3934470 | 0.1602002 | 0.7681129 | 0.1857183 | 1.645807 | 0.2968294 | 0.3093450 | 1.206995 | 0.1646503 | 0.1606870 | 0.1882214 | 0.1047838 | 0.1419830 | 0.1677096 | 0.1368377 | 0.1160478 | 0.2555277 | 0.1408705 | 0.4812265 | 0.2517730 | 1.534835 | 2.009109 | 0.1195244 | 0.9977750 | 0.8786678 | 0.2056042 | 0.1299541 | NA | 0.1047838 | 0.1106939 | 0.4341538 | 0.1184814 | 0.1403143 | 0.1483799 | 1.839730 | Control | Memantine | C/S | c-CS-m |
| 309_6 | 0.4475064 | 0.6281758 | 0.3673881 | 2.385939 | 4.807635 | 0.2185778 | 0.1762334 | 2.141282 | 0.1951875 | 1.442398 | 0.5663396 | 0.2898239 | 0.3638930 | 0.2668369 | 0.8591209 | 0.5213066 | 1.538244 | 1.968275 | 0.4959000 | 0.6724022 | 0.3694045 | 0.3571717 | 0.1797285 | 1.227450 | 2.956984 | 1.447910 | 0.2508402 | 0.2840436 | 0.7043958 | 0.1568759 | 0.3910472 | 2.467133 | 0.3275978 | 0.4044899 | 0.2962764 | 0.6744186 | 0.5397231 | 0.3542143 | 0.5143164 | 0.3472241 | 0.3031321 | 0.4128243 | 0.3825783 | 0.1623303 | 0.7796946 | 0.1867930 | 1.634615 | 0.2880373 | 0.3323671 | 1.123445 | 0.1756929 | 0.1505939 | 0.1838235 | 0.1064762 | 0.1395645 | 0.1748445 | 0.1305147 | 0.1152432 | 0.2368495 | 0.1364536 | 0.4785775 | 0.2444853 | 1.507777 | 2.003535 | 0.1206872 | 0.9201782 | 0.8436793 | 0.1904695 | 0.1315752 | NA | 0.1064762 | 0.1094457 | 0.4398331 | 0.1166572 | 0.1407664 | 0.1421804 | 1.816389 | Control | Memantine | C/S | c-CS-m |
The calculations of the minimum, maximum, average and median of these two proteins:
min_CDK5_N <- min(df$CDK5_N)
max_CDK5_N <- max(df$CDK5_N)
mean_CDK5_N <- mean(df$CDK5_N)
median_CDK5_N <- median(df$CDK5_N)
min_Tau_N <- min(df$Tau_N)
max_Tau_N <- max(df$Tau_N)
mean_Tau_N <- mean(df$Tau_N)
median_Tau_N <- median(df$Tau_N)
results_ex1 <- tibble("measure" = c("minimum", "maximum", "mean", "median"),
"CDK5_N" = c(min_CDK5_N, max_CDK5_N, mean_CDK5_N, median_CDK5_N),
"Tau_N" = c(min_Tau_N, max_Tau_N, mean_Tau_N, median_Tau_N)
)
formatted_table(results_ex1)|
measure chr |
CDK5_N dbl |
Tau_N dbl |
|---|---|---|
| minimum | 0.1811570 | 0.0962328 |
| maximum | 0.8174018 | 0.6027681 |
| mean | 0.2924341 | 0.2104892 |
| median | 0.2938195 | 0.1886295 |
Exercise 2
Index, filter and sort your data frame to answer the following
questions:
1. Which mouse has the highest expression of the Tau protein?
2. What is the relative expression value of this protein in this
particular mouse?
3. Which mouse has the lowest expression of the pAKT protein?
4. How many empty cells (NA) are in the BAD column? Use the
summary function to find the amount of empty cells.
5. Which mouse of the Ts65Dn genotype group has the highest Tau
expression (use multi-sorting)?
6. Which mouse of the Ts65Dn genotype, and saline treatment group has
the highest Tau expression (use multi-sorting)?
Mouse with the highest expression of the protein
Tau_N:
|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3516_12 | 0.1847187 | 0.300084 | 0.2303946 | 1.605206 | 2.353988 | 0.1748111 | 0.1407221 | 2.582368 | 0.159026 | 0.8243493 | 0.2082284 | 0.2288833 | 0.2129303 | 0.2099076 | 0.6481948 | 0.5418976 | 1.11419 | 0.7277918 | 0.3983207 | 0.5694374 | 0.1838791 | 0.3036104 | 0.1449202 | 0.9286314 | 1.42754 | 0.6048699 | 0.1692695 | 0.1895886 | 0.4267003 | 0.1326616 | 0.2609572 | 1.479261 | 0.5465995 | 0.3877414 | 0.418136 | 0.6283795 | 0.4498741 | 0.2653233 | 0.4574307 | 0.2458438 | 0.2577666 | 0.3361881 | 0.3242653 | 0.1699014 | 0.8671651 | 0.1592428 | 1.247216 | 0.2446707 | 0.6259943 | 0.8515749 | 1.156856 | 0.2020363 | 0.1662424 | 0.136812 | 0.1854916 | 0.1783328 | 0.6027681 | 0.1492205 | 0.2268533 | 0.1172447 | 0.7629653 | 0.3020999 | 1.478206 | 2.270283 | 0.2068088 | 1.160197 | 0.7424435 | 0.2378301 | 0.1878778 | 0.163538 | 0.136812 | 0.1808781 | 0.3919822 | NA | 0.298441 | 0.3736876 | 1.014795 | Control | Saline | S/C | c-SC-s |
The relative expression value for this protein in this particular mouse. First, we need to find in which row the maximum value for the highest expression of the Tau protein is stored. First we calculate the max value for this column:
## [1] 0.6027681
Then we create a logical factor to match the highest number.
## [1] FALSE FALSE FALSE FALSE FALSE FALSE
Then we can search in the data frame for the row that matches the logical.
## # A tibble: 1 × 82
## MouseID DYRK1A_N ITSN1_N BDNF_N NR1_N NR2A_N pAKT_N pBRAF_N pCAMKII_N pCREB_N
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 3516_12 0.185 0.300 0.230 1.61 2.35 0.175 0.141 2.58 0.159
## # ℹ 72 more variables: pELK_N <dbl>, pERK_N <dbl>, pJNK_N <dbl>, PKCA_N <dbl>,
## # pMEK_N <dbl>, pNR1_N <dbl>, pNR2A_N <dbl>, pNR2B_N <dbl>, pPKCAB_N <dbl>,
## # pRSK_N <dbl>, AKT_N <dbl>, BRAF_N <dbl>, CAMKII_N <dbl>, CREB_N <dbl>,
## # ELK_N <dbl>, ERK_N <dbl>, GSK3B_N <dbl>, JNK_N <dbl>, MEK_N <dbl>,
## # TRKA_N <dbl>, RSK_N <dbl>, APP_N <dbl>, Bcatenin_N <dbl>, SOD1_N <dbl>,
## # MTOR_N <dbl>, P38_N <dbl>, pMTOR_N <dbl>, DSCR1_N <dbl>, AMPKA_N <dbl>,
## # NR2B_N <dbl>, pNUMB_N <dbl>, RAPTOR_N <dbl>, TIAM1_N <dbl>, …
Or tidyverse style:
|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3516_12 | 0.1847187 | 0.300084 | 0.2303946 | 1.605206 | 2.353988 | 0.1748111 | 0.1407221 | 2.582368 | 0.159026 | 0.8243493 | 0.2082284 | 0.2288833 | 0.2129303 | 0.2099076 | 0.6481948 | 0.5418976 | 1.11419 | 0.7277918 | 0.3983207 | 0.5694374 | 0.1838791 | 0.3036104 | 0.1449202 | 0.9286314 | 1.42754 | 0.6048699 | 0.1692695 | 0.1895886 | 0.4267003 | 0.1326616 | 0.2609572 | 1.479261 | 0.5465995 | 0.3877414 | 0.418136 | 0.6283795 | 0.4498741 | 0.2653233 | 0.4574307 | 0.2458438 | 0.2577666 | 0.3361881 | 0.3242653 | 0.1699014 | 0.8671651 | 0.1592428 | 1.247216 | 0.2446707 | 0.6259943 | 0.8515749 | 1.156856 | 0.2020363 | 0.1662424 | 0.136812 | 0.1854916 | 0.1783328 | 0.6027681 | 0.1492205 | 0.2268533 | 0.1172447 | 0.7629653 | 0.3020999 | 1.478206 | 2.270283 | 0.2068088 | 1.160197 | 0.7424435 | 0.2378301 | 0.1878778 | 0.163538 | 0.136812 | 0.1808781 | 0.3919822 | NA | 0.298441 | 0.3736876 | 1.014795 | Control | Saline | S/C | c-SC-s |
Mouse with the lowest expression of the pAKT protein. There are NA
values in this column, so will have to use the na.rm =
argument in the calculation:
formatted_table(filter(df, `pAKT_N` == min(df$pAKT_N, na.rm = TRUE))) # this will remove all NA values and then show the mouse with minimal value for pAKT|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3479_9 | 0.4087756 | 0.5339571 | 0.3169866 | 2.163252 | 3.720761 | 0.063236 | 0.0640426 | 2.488143 | 0.1808356 | 1.2794 | 0.4644297 | 0.0556541 | 0.3815131 | 0.0696887 | 0.7394741 | 0.5015325 | 1.399419 | 2.17519 | 0.0974351 | 0.0711405 | 0.3747379 | 0.3311824 | 0.1574447 | NA | 2.483465 | 1.277303 | 0.0462978 | NA | 0.6483304 | 0.1466366 | 0.370705 | 2.034038 | 0.3095661 | 0.4453944 | 0.3910308 | 0.667527 | 0.5713825 | 0.3474754 | 0.5373447 | 0.3365059 | 0.3202129 | 0.4149056 | 0.7280206 | 0.149593 | 0.6998213 | 0.1568394 | 2.467143 | 0.2811197 | 0.3685726 | 1.511118 | 0.1496923 | 0.1470121 | 0.1822513 | 0.1137582 | 0.1585269 | 0.1625968 | 0.1704388 | 0.1183244 | 0.2510423 | 0.1312289 | 0.4688307 | 0.3281715 | 1.252829 | 2.065118 | 0.142843 | 0.9968235 | 0.8511018 | 0.2282112 | NA | NA | 0.1137582 | 0.1168354 | 0.4192972 | 0.1396665 | NA | 0.1834425 | 1.42158 | Control | Saline | C/S | c-CS-s |
Or tidyverse style:
|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3479_9 | 0.4087756 | 0.5339571 | 0.3169866 | 2.163252 | 3.720761 | 0.063236 | 0.0640426 | 2.488143 | 0.1808356 | 1.2794 | 0.4644297 | 0.0556541 | 0.3815131 | 0.0696887 | 0.7394741 | 0.5015325 | 1.399419 | 2.17519 | 0.0974351 | 0.0711405 | 0.3747379 | 0.3311824 | 0.1574447 | NA | 2.483465 | 1.277303 | 0.0462978 | NA | 0.6483304 | 0.1466366 | 0.370705 | 2.034038 | 0.3095661 | 0.4453944 | 0.3910308 | 0.667527 | 0.5713825 | 0.3474754 | 0.5373447 | 0.3365059 | 0.3202129 | 0.4149056 | 0.7280206 | 0.149593 | 0.6998213 | 0.1568394 | 2.467143 | 0.2811197 | 0.3685726 | 1.511118 | 0.1496923 | 0.1470121 | 0.1822513 | 0.1137582 | 0.1585269 | 0.1625968 | 0.1704388 | 0.1183244 | 0.2510423 | 0.1312289 | 0.4688307 | 0.3281715 | 1.252829 | 2.065118 | 0.142843 | 0.9968235 | 0.8511018 | 0.2282112 | NA | NA | 0.1137582 | 0.1168354 | 0.4192972 | 0.1396665 | NA | 0.1834425 | 1.42158 | Control | Saline | C/S | c-CS-s |
Amount of empty cells (NA) in the BAD column:
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.0883 0.1364 0.1523 0.1579 0.1740 0.2820 213
The amount of empty cells is in the last column.
Or:
## [1] 213
Mouse of the Ts65Dn genotype group with the highest Tau expression:
|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 293_15 | 0.2095214 | 0.4619390 | 0.2940739 | 2.100917 | 2.607736 | 0.2873791 | 0.2062980 | 3.364741 | 0.2444830 | 1.1919167 | 0.2303496 | 0.3431689 | 0.2757253 | 0.3032482 | 0.7827920 | 0.7354327 | 1.429209 | 1.0151252 | 0.4986363 | 0.6640218 | 0.2987850 | 0.4125961 | 0.2077858 | 0.9707414 | 2.005703 | 0.9186710 | 0.2303496 | 0.2670469 | 0.6335234 | 0.2097694 | 0.3520952 | 1.799157 | 1.0292586 | 0.4160674 | 0.3568063 | 0.7706422 | 0.6241012 | 0.3245723 | 0.5643442 | 0.3047359 | 0.3223407 | 0.3788743 | 0.3927597 | 0.1849418 | 0.8912880 | 0.1781825 | 1.625986 | 0.2472775 | 0.5383027 | 1.105145 | 0.9179497 | 0.2114157 | 0.1697334 | 0.1378145 | 0.1937664 | 0.1856928 | 0.5137063 | 0.1314307 | 0.1802478 | 0.1030792 | 0.6845663 | 0.3133684 | 1.793842 | 2.458881 | 0.1749906 | 1.443860 | 0.8561772 | 0.2069095 | 0.1684191 | 0.1378145 | 0.1378145 | 0.1182876 | 0.4990612 | 0.4355989 | 0.2005257 | 0.3332707 | 1.2829516 | Ts65Dn | Memantine | S/C | t-SC-m |
| 293_14 | 0.1914640 | 0.4432523 | 0.2627563 | 1.998093 | 2.582260 | 0.2610873 | 0.1921793 | 3.230567 | 0.2546495 | 1.1826419 | 0.2401049 | 0.3106819 | 0.2713400 | 0.2901764 | 0.7663329 | 0.6950405 | 1.324511 | 0.9439676 | 0.4530281 | 0.6254173 | 0.2804006 | 0.3786361 | 0.1890796 | 0.9711493 | 1.920839 | 0.8738674 | 0.2603720 | 0.2396280 | 0.6096805 | 0.2041011 | 0.3218884 | 1.715785 | 0.9983309 | 0.3781593 | 0.3593228 | 0.7157845 | 0.6120649 | 0.3061516 | 0.5202670 | 0.3004292 | 0.3090129 | 0.3667144 | 0.3500238 | 0.1781214 | 0.8953799 | 0.1798396 | 1.663230 | 0.2338679 | 0.5282551 | 1.157885 | 0.9320351 | 0.2191676 | 0.1876670 | 0.1397480 | 0.1905307 | 0.1880489 | 0.5036273 | 0.1307751 | 0.1895762 | 0.1191294 | 0.6922490 | 0.3077511 | 1.730622 | 2.410271 | 0.1914853 | 1.411989 | 0.8669339 | 0.2037037 | 0.1611302 | 0.1586483 | 0.1397480 | 0.1357388 | 0.4854906 | 0.4797633 | 0.2042764 | 0.3193967 | 1.2997327 | Ts65Dn | Memantine | S/C | t-SC-m |
| 293_13 | 0.2274182 | 0.4440069 | 0.3101157 | 2.093035 | 2.882599 | 0.2739355 | 0.2035442 | 3.312577 | 0.2569530 | 1.2109279 | 0.2562146 | 0.3138075 | 0.2818115 | 0.2914103 | 0.7839035 | 0.7238494 | 1.352941 | 0.9822791 | 0.4902781 | 0.6793010 | 0.3416195 | 0.3780458 | 0.1912380 | 1.0620231 | 1.994339 | 0.8949052 | 0.2284027 | 0.2483387 | 0.6330298 | 0.2156042 | 0.3465420 | 1.765690 | 1.0750677 | 0.4056116 | 0.4009353 | 0.7615063 | 0.6032488 | 0.3066699 | 0.5291656 | 0.3364509 | 0.3337435 | 0.3760768 | 0.3359587 | 0.1756604 | 0.8732075 | 0.1784906 | 1.650377 | 0.2616981 | 0.5164151 | 1.174906 | 0.9371698 | 0.2158491 | 0.1737736 | 0.1307547 | 0.1858491 | 0.1722642 | 0.4681132 | 0.1290566 | 0.1845283 | 0.1024528 | 0.6741509 | 0.3056604 | 1.727359 | 2.335094 | 0.1762264 | 1.383585 | 0.8177358 | 0.2128302 | 0.1566038 | 0.1383019 | 0.1307547 | 0.1332075 | 0.4681132 | 0.4550943 | 0.2018868 | 0.3094340 | 1.2694340 | Ts65Dn | Memantine | S/C | t-SC-m |
| 3418_12 | 0.2657622 | 0.3982442 | 0.2952913 | 1.913009 | 2.715350 | 0.2537909 | 0.1987231 | 2.067039 | 0.1931365 | 1.2096302 | 0.2657622 | 0.2942272 | 0.3139133 | 0.2889066 | 0.7509976 | 0.6515031 | 1.287576 | 0.8704443 | 0.3830806 | 0.5810056 | 0.2197393 | 0.3506252 | 0.1785049 | 0.9481245 | 1.499335 | 0.8047353 | 0.2149508 | 0.2580474 | 0.5086459 | 0.1633413 | 0.4192604 | 1.673051 | 0.7584464 | 0.5293961 | 0.5921788 | 0.8233573 | 0.6914073 | 0.4519819 | 0.6254323 | 0.3761639 | 0.4418728 | 0.5014632 | 0.5243416 | 0.1554742 | 0.7367919 | 0.1542011 | 1.408975 | 0.2530236 | 0.2870783 | 1.072565 | 0.9000637 | 0.2345640 | 0.1830045 | 0.1352642 | 0.1721833 | 0.2021006 | 0.4194780 | 0.1421069 | 0.1871419 | 0.1288988 | 0.5300764 | 0.2969446 | 1.569542 | 1.974857 | 0.2005092 | 1.214672 | 0.7184914 | 0.2210376 | NA | NA | 0.1352642 | 0.1592934 | 0.3965627 | NA | NA | 0.3820815 | 0.8026735 | Ts65Dn | Memantine | S/C | t-SC-m |
| 293_12 | 0.2264906 | 0.4789916 | 0.2745098 | 2.087635 | 2.906163 | 0.2593037 | 0.1902761 | 3.491597 | 0.2310924 | 1.1068427 | 0.2733093 | 0.3173269 | 0.2697079 | 0.2939176 | 0.7741096 | 0.7430972 | 1.436775 | 0.9261705 | 0.4881953 | 0.6036415 | 0.2639056 | 0.3707483 | 0.2062825 | 0.9809924 | 2.065626 | 0.9267707 | 0.2214886 | 0.2484994 | 0.6270508 | 0.1846739 | 0.3633453 | 1.944178 | 0.9469788 | 0.3975590 | 0.3541417 | 0.7490996 | 0.5732293 | 0.3065226 | 0.5308123 | 0.2943177 | 0.3001200 | 0.3617447 | 0.3321329 | 0.1764966 | 0.8731937 | 0.1741374 | 1.564730 | 0.2595105 | 0.5535240 | 1.115748 | 0.8498968 | 0.1906517 | 0.1773813 | 0.1383073 | 0.1893247 | 0.1838691 | 0.4189030 | 0.1360955 | 0.1884400 | 0.1182542 | 0.6483338 | 0.2965202 | 1.839723 | 2.503391 | 0.1585078 | 1.450015 | 0.8428192 | 0.2198467 | 0.1368328 | 0.1263639 | 0.1383073 | 0.1138307 | 0.4899735 | 0.4535535 | 0.1964022 | 0.3164258 | 1.2547921 | Ts65Dn | Memantine | S/C | t-SC-m |
| J3295_14 | 0.2212424 | 0.4128944 | 0.2439741 | 1.876347 | 2.384088 | 0.2088967 | 0.1736234 | 2.086028 | 0.1920439 | 0.9225946 | 0.2306486 | 0.2631785 | 0.2243778 | 0.2774838 | 0.6650990 | 0.4795219 | 1.077014 | 1.1150304 | 0.4346463 | 0.5647658 | 0.2567117 | 0.3131491 | 0.1722516 | 0.7818930 | 1.558887 | 0.8728199 | 0.2380952 | 0.2704292 | 0.5851460 | 0.1634333 | 0.3411719 | 1.571821 | 0.6984127 | 0.3564570 | 0.3084460 | 0.5457574 | 0.4805017 | 0.2580835 | 0.4266118 | 0.2584754 | 0.2159514 | 0.3015873 | 0.4904958 | 0.1975667 | 0.7848193 | 0.1754131 | 2.659706 | 0.3410205 | 0.6426366 | 0.783185 | 0.5382241 | 0.2120937 | 0.1614309 | 0.1252951 | 0.1725077 | 0.1937534 | 0.4142001 | 0.1492646 | 0.2044670 | 0.1245687 | 0.6217541 | 0.3522789 | 1.498820 | 2.609769 | 0.1850372 | 1.301071 | 0.9892864 | 0.3067006 | 0.2222626 | NA | 0.1252951 | 0.1962956 | 0.3976757 | 0.3359361 | 0.2513165 | 0.3653532 | 1.4040312 | Ts65Dn | Saline | S/C | t-SC-s |
Or to filter for the row:
my_answer <- df %>%
filter(Genotype == "Ts65Dn") %>%
filter(Tau_N == max(Tau_N, na.rm = T))
formatted_table(my_answer)|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 293_15 | 0.2095214 | 0.461939 | 0.2940739 | 2.100917 | 2.607736 | 0.2873791 | 0.206298 | 3.364741 | 0.244483 | 1.191917 | 0.2303496 | 0.3431689 | 0.2757253 | 0.3032482 | 0.782792 | 0.7354327 | 1.429209 | 1.015125 | 0.4986363 | 0.6640218 | 0.298785 | 0.4125961 | 0.2077858 | 0.9707414 | 2.005703 | 0.918671 | 0.2303496 | 0.2670469 | 0.6335234 | 0.2097694 | 0.3520952 | 1.799157 | 1.029259 | 0.4160674 | 0.3568063 | 0.7706422 | 0.6241012 | 0.3245723 | 0.5643442 | 0.3047359 | 0.3223407 | 0.3788743 | 0.3927597 | 0.1849418 | 0.891288 | 0.1781825 | 1.625986 | 0.2472775 | 0.5383027 | 1.105145 | 0.9179497 | 0.2114157 | 0.1697334 | 0.1378145 | 0.1937664 | 0.1856928 | 0.5137063 | 0.1314307 | 0.1802478 | 0.1030792 | 0.6845663 | 0.3133684 | 1.793842 | 2.458881 | 0.1749906 | 1.44386 | 0.8561772 | 0.2069095 | 0.1684191 | 0.1378145 | 0.1378145 | 0.1182876 | 0.4990612 | 0.4355989 | 0.2005257 | 0.3332707 | 1.282952 | Ts65Dn | Memantine | S/C | t-SC-m |
Mouse of the Ts65Dn genotype, and saline treatment group with the highest Tau expression (use multi-sorting):
df %>%
arrange(desc(Genotype), desc(Treatment), desc(Tau_N)) %>%
slice_head(n = 6) %>%
formatted_table()|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| J3295_14 | 0.2212424 | 0.4128944 | 0.2439741 | 1.876347 | 2.384088 | 0.2088967 | 0.1736234 | 2.086028 | 0.1920439 | 0.9225946 | 0.2306486 | 0.2631785 | 0.2243778 | 0.2774838 | 0.6650990 | 0.4795219 | 1.077014 | 1.115030 | 0.4346463 | 0.5647658 | 0.2567117 | 0.3131491 | 0.1722516 | 0.7818930 | 1.558887 | 0.8728199 | 0.2380952 | 0.2704292 | 0.5851460 | 0.1634333 | 0.3411719 | 1.571821 | 0.6984127 | 0.3564570 | 0.3084460 | 0.5457574 | 0.4805017 | 0.2580835 | 0.4266118 | 0.2584754 | 0.2159514 | 0.3015873 | 0.4904958 | 0.1975667 | 0.7848193 | 0.1754131 | 2.659706 | 0.3410205 | 0.6426366 | 0.7831850 | 0.5382241 | 0.2120937 | 0.1614309 | 0.1252951 | 0.1725077 | 0.1937534 | 0.4142001 | 0.1492646 | 0.2044670 | 0.1245687 | 0.6217541 | 0.3522789 | 1.498820 | 2.609769 | 0.1850372 | 1.301071 | 0.9892864 | 0.3067006 | 0.2222626 | NA | 0.1252951 | 0.1962956 | 0.3976757 | 0.3359361 | 0.2513165 | 0.3653532 | 1.404031 | Ts65Dn | Saline | S/C | t-SC-s |
| J3295_4 | 0.3560120 | 0.5851106 | 0.3136203 | 2.545074 | 3.794452 | 0.2211174 | 0.1765014 | 3.232369 | 0.2311919 | 1.1564831 | 0.3342928 | 0.3078634 | 0.2894152 | 0.2881068 | 0.9255528 | 0.6481748 | 1.468533 | 1.370012 | 0.4508701 | 0.7078372 | 0.2580139 | 0.3812639 | 0.1690436 | 1.2771163 | 2.544420 | 1.1822583 | 0.2701819 | 0.2984430 | 0.7913123 | 0.1725762 | 0.4359545 | 2.507131 | 1.1441842 | 0.4316368 | 0.3643857 | 0.6835012 | 0.5479524 | 0.3324611 | 0.5781761 | 0.3110035 | 0.2629857 | 0.4164595 | 0.5737276 | 0.2348905 | 0.9843509 | 0.1625809 | 2.392229 | 0.3113629 | 0.6788467 | 0.8755011 | 0.5740826 | 0.1790009 | 0.1871724 | 0.1258094 | 0.1652791 | 0.2077552 | 0.4128122 | 0.1212612 | 0.2247148 | 0.1396855 | 0.5862627 | 0.3575393 | 1.508017 | 2.502081 | 0.1549491 | 1.238128 | 0.9303885 | 0.2401326 | 0.1686710 | NA | 0.1258094 | 0.1125501 | 0.4282300 | 0.2957909 | 0.1809282 | 0.2553191 | 1.379201 | Ts65Dn | Saline | S/C | t-SC-s |
| J3295_11 | 0.2548604 | 0.4635914 | 0.2548604 | 2.092082 | 2.600035 | 0.2117356 | 0.1712619 | 2.483740 | 0.2073171 | 1.0579710 | 0.2656416 | 0.2940969 | 0.2499116 | 0.2612230 | 0.7462001 | 0.5106045 | 1.220926 | 1.241958 | 0.4227642 | 0.6382114 | 0.2557441 | 0.3308590 | 0.1901732 | 0.8964298 | 1.822906 | 0.9931071 | 0.2363026 | 0.2492047 | 0.6417462 | 0.1656062 | 0.3722163 | 1.828208 | 0.8200778 | 0.3801697 | 0.3204312 | 0.5993284 | 0.5081301 | 0.2700601 | 0.4379639 | 0.2605161 | 0.2391304 | 0.3407565 | 0.5270414 | 0.2094329 | 0.7879001 | 0.1781303 | 2.630825 | 0.3190623 | 0.6545480 | 0.7372263 | 0.5329871 | 0.1966592 | 0.1827625 | 0.1158057 | 0.1603032 | 0.1893599 | 0.4112858 | 0.1348961 | 0.2077485 | 0.1344750 | 0.5036496 | 0.3263616 | 1.323554 | 2.578046 | 0.1671814 | 1.261651 | 0.9629422 | 0.2755474 | 0.1904829 | NA | 0.1158057 | 0.1833240 | 0.3740876 | 0.3187816 | 0.2046603 | 0.3283268 | 1.364823 | Ts65Dn | Saline | S/C | t-SC-s |
| J3295_12 | 0.2721980 | 0.4741630 | 0.2516376 | 2.161390 | 2.801492 | 0.2512737 | 0.1824964 | 2.512736 | 0.2163392 | 1.0811499 | 0.2703785 | 0.2851164 | 0.2498180 | 0.2525473 | 0.7498180 | 0.5243814 | 1.218705 | 1.361354 | 0.4152111 | 0.6451965 | 0.2520015 | 0.3386099 | 0.1812227 | 0.9588792 | 1.879913 | 0.9748908 | 0.2454512 | 0.2621907 | 0.6935953 | 0.1915939 | 0.3609898 | 1.883370 | 0.8542576 | 0.3802766 | 0.3382460 | 0.6146288 | 0.5191048 | 0.2734716 | 0.5800582 | 0.2758370 | 0.2350801 | 0.3462518 | 0.5183770 | 0.1943331 | 0.7630961 | 0.1704216 | 2.593227 | 0.3188666 | 0.6320663 | 0.7560470 | 0.5466482 | 0.1883898 | 0.1669661 | 0.1136144 | 0.1615757 | 0.1871458 | 0.4020733 | 0.1306151 | 0.2051140 | 0.1221838 | 0.5126469 | 0.3441603 | 1.275605 | 2.534347 | 0.1695923 | 1.254872 | 0.9836904 | 0.2832066 | 0.1904630 | NA | 0.1136144 | 0.1756738 | 0.3752592 | 0.3256393 | 0.2004147 | 0.2934347 | 1.364478 | Ts65Dn | Saline | S/C | t-SC-s |
| J3295_7 | 0.3184478 | 0.5097013 | 0.2905759 | 2.314752 | 3.041115 | 0.2291346 | 0.1758546 | 2.881429 | 0.2060363 | 1.0883893 | 0.3058208 | 0.2996612 | 0.2814906 | 0.2770249 | 0.8500154 | 0.5708346 | 1.367570 | 1.271943 | 0.4317832 | 0.6510625 | 0.2597783 | 0.3429319 | 0.1806283 | 1.0418848 | 2.218509 | 1.0734524 | 0.2389898 | 0.2796427 | 0.7283646 | 0.1707730 | 0.3948260 | 2.175239 | 0.9675085 | 0.4006775 | 0.3341546 | 0.6458269 | 0.5249461 | 0.2958115 | 0.5637512 | 0.2858023 | 0.2510009 | 0.3657222 | 0.5617493 | 0.2189847 | 0.9053770 | 0.1639131 | 2.497146 | 0.3221188 | 0.6628617 | 0.8015420 | 0.5495144 | 0.1802343 | 0.1786322 | 0.1278662 | 0.1638130 | 0.1964554 | 0.4020226 | 0.1273656 | 0.2155803 | 0.1356764 | 0.5640332 | 0.3415440 | 1.410534 | 2.482728 | 0.1564033 | 1.196055 | 0.8810454 | 0.2363072 | 0.1724242 | NA | 0.1278662 | 0.1272654 | 0.4051267 | 0.3071994 | 0.1923501 | 0.2699509 | 1.340743 | Ts65Dn | Saline | S/C | t-SC-s |
| J3295_5 | 0.3298292 | 0.5730618 | 0.3346912 | 2.548357 | 3.808279 | 0.2290407 | 0.1816032 | 3.299343 | 0.2289093 | 1.1930355 | 0.3294350 | 0.3137976 | 0.2854139 | 0.2696452 | 0.8884363 | 0.6582129 | 1.516557 | 1.417608 | 0.4536137 | 0.7105125 | 0.2588699 | 0.3609724 | 0.1877792 | 1.2617608 | 2.520631 | 1.1777924 | 0.2703022 | 0.2965834 | 0.7871222 | 0.1681997 | 0.4554534 | 2.487516 | 1.1074901 | 0.4323259 | 0.3796321 | 0.6919842 | 0.5484888 | 0.3224704 | 0.5802891 | 0.3137976 | 0.2693824 | 0.4143233 | 0.5582129 | 0.2278800 | 0.9874800 | 0.1523017 | 2.410184 | 0.3088785 | 0.6921139 | 0.8786930 | 0.5841667 | 0.1784869 | 0.1871135 | 0.1215360 | 0.1630659 | 0.1999389 | 0.3983510 | 0.1223758 | 0.2089472 | 0.1368043 | 0.5514925 | 0.3497977 | 1.440644 | 2.160165 | 0.1533705 | 1.189480 | 0.9071685 | 0.2410871 | 0.1633712 | NA | 0.1215360 | 0.1067257 | 0.3974349 | 0.2977327 | 0.1782579 | 0.2462783 | 1.390946 | Ts65Dn | Saline | S/C | t-SC-s |
Or to filter for the row:
my_answer <- df %>%
filter(Genotype == "Ts65Dn") %>%
filter(Treatment == "Saline") %>%
filter(Tau_N == max(Tau_N, na.rm = T))
formatted_table(my_answer)|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| J3295_14 | 0.2212424 | 0.4128944 | 0.2439741 | 1.876347 | 2.384088 | 0.2088967 | 0.1736234 | 2.086028 | 0.1920439 | 0.9225946 | 0.2306486 | 0.2631785 | 0.2243778 | 0.2774838 | 0.665099 | 0.4795219 | 1.077014 | 1.11503 | 0.4346463 | 0.5647658 | 0.2567117 | 0.3131491 | 0.1722516 | 0.781893 | 1.558887 | 0.8728199 | 0.2380952 | 0.2704292 | 0.585146 | 0.1634333 | 0.3411719 | 1.571821 | 0.6984127 | 0.356457 | 0.308446 | 0.5457574 | 0.4805017 | 0.2580835 | 0.4266118 | 0.2584754 | 0.2159514 | 0.3015873 | 0.4904958 | 0.1975667 | 0.7848193 | 0.1754131 | 2.659706 | 0.3410205 | 0.6426366 | 0.783185 | 0.5382241 | 0.2120937 | 0.1614309 | 0.1252951 | 0.1725077 | 0.1937534 | 0.4142001 | 0.1492646 | 0.204467 | 0.1245687 | 0.6217541 | 0.3522789 | 1.49882 | 2.609769 | 0.1850372 | 1.301071 | 0.9892864 | 0.3067006 | 0.2222626 | NA | 0.1252951 | 0.1962956 | 0.3976757 | 0.3359361 | 0.2513165 | 0.3653532 | 1.404031 | Ts65Dn | Saline | S/C | t-SC-s |
Exercise 3
- An relative expression level > 0.5 would be considered a high
expression level. How many mice do have a high expression level for
DYRK1A?
- Apply this calculation for all proteins. For which protein do you
observe a count of 218? Hint: you can calculate the mean and the sum for
multiple columns at once with the
colMeansandcolSumsfunctions.
- The average pELK expression is higher than pERK. But how many mice do have higher expression levels for pELK than 0.75 AND higher expression levels for pERK than 0.25?
You can use the sum function to count how many times the
value for DYRK1A is higher than 0.5. However, there are NA values in
this column, so you will have to use the na.rm = argument
in the sum function.
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.1453 0.2881 0.3664 0.4258 0.4877 2.5164 3
## [1] "Yes, there are 3 NA values in this column!"
## [1] 255
Note: the nrow function does not work in this case,
because it will include the rows with NA values. Compare
with the previous answer:
## [1] 258
The protein that has a higher relative expression value than 0.5 in 218 mice.
only_nums <- select_if(df, is.numeric) # select only columns with numeric values
colSums(only_nums > 0.5, na.rm = TRUE)## DYRK1A_N ITSN1_N BDNF_N NR1_N NR2A_N
## 255 726 0 1077 1077
## pAKT_N pBRAF_N pCAMKII_N pCREB_N pELK_N
## 1 0 1077 0 1076
## pERK_N pJNK_N PKCA_N pMEK_N pNR1_N
## 449 0 0 0 1077
## pNR2A_N pNR2B_N pPKCAB_N pRSK_N AKT_N
## 952 1074 1077 195 1009
## BRAF_N CAMKII_N CREB_N ELK_N ERK_N
## 167 12 0 1061 1077
## GSK3B_N JNK_N MEK_N TRKA_N RSK_N
## 1076 0 0 1003 0
## APP_N Bcatenin_N SOD1_N MTOR_N P38_N
## 71 1062 506 225 165
## pMTOR_N DSCR1_N AMPKA_N NR2B_N pNUMB_N
## 1062 922 39 868 22
## RAPTOR_N TIAM1_N pP70S6_N NUMB_N P70S6_N
## 5 126 229 0 1077
## pGSK3B_N pPKCG_N CDK5_N S6_N ADARB1_N
## 0 1080 1 347 1080
## AcetylH3K9_N RRP1_N BAX_N ARC_N ERBB4_N
## 79 1 0 0 0
## nNOS_N Tau_N GFAP_N GluR3_N GluR4_N
## 0 7 0 0 1
## IL1B_N P3525_N pCASP9_N PSD95_N SNCA_N
## 669 0 1080 1080 0
## Ubiquitin_N pGSK3B_Tyr216_N SHH_N BAD_N BCL2_N
## 1080 1080 0 0 0
## pS6_N pCFOS_N SYP_N H3AcK18_N EGR1_N
## 0 0 218 0 0
## H3MeK4_N CaNA_N
## 0 1080
Or in tidyverse style:
## # A tibble: 1 × 77
## DYRK1A_N ITSN1_N BDNF_N NR1_N NR2A_N pAKT_N pBRAF_N pCAMKII_N pCREB_N pELK_N
## <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
## 1 255 726 0 1077 1077 1 0 1077 0 1076
## # ℹ 67 more variables: pERK_N <int>, pJNK_N <int>, PKCA_N <int>, pMEK_N <int>,
## # pNR1_N <int>, pNR2A_N <int>, pNR2B_N <int>, pPKCAB_N <int>, pRSK_N <int>,
## # AKT_N <int>, BRAF_N <int>, CAMKII_N <int>, CREB_N <int>, ELK_N <int>,
## # ERK_N <int>, GSK3B_N <int>, JNK_N <int>, MEK_N <int>, TRKA_N <int>,
## # RSK_N <int>, APP_N <int>, Bcatenin_N <int>, SOD1_N <int>, MTOR_N <int>,
## # P38_N <int>, pMTOR_N <int>, DSCR1_N <int>, AMPKA_N <int>, NR2B_N <int>,
## # pNUMB_N <int>, RAPTOR_N <int>, TIAM1_N <int>, pP70S6_N <int>, …
Also here, you can use the sum function to count how
many times the value for pELK is higher than 0.75 anf for pERK is lower
than 0.25.
## [1] 1040
Exersise 4
Note that this exercise differs a bit from the Excel counterpart. We do not use conditional formatting but selection of rows instead.
- Select rows with a relative expression value higher than 2.3 for the
pCASP9 protein. Which treatment is mostly found for these selected
proteins?
- Select rows with duplicate MouseIDs. Are there any duplicate
MouseIDs?
- Select the following columns: MouseID, APP_N, NR1_N, pCREB_N, S6_N,
and Genotype.
- Select everything but the columns with relative expression measurements. Hint: the column names of the column with relative expression values all have something in common.
Select rows with a relative expression value higher than 2.3 for the pCASP9 protein:
|
MouseID chr |
DYRK1A_N dbl |
ITSN1_N dbl |
BDNF_N dbl |
NR1_N dbl |
NR2A_N dbl |
pAKT_N dbl |
pBRAF_N dbl |
pCAMKII_N dbl |
pCREB_N dbl |
pELK_N dbl |
pERK_N dbl |
pJNK_N dbl |
PKCA_N dbl |
pMEK_N dbl |
pNR1_N dbl |
pNR2A_N dbl |
pNR2B_N dbl |
pPKCAB_N dbl |
pRSK_N dbl |
AKT_N dbl |
BRAF_N dbl |
CAMKII_N dbl |
CREB_N dbl |
ELK_N dbl |
ERK_N dbl |
GSK3B_N dbl |
JNK_N dbl |
MEK_N dbl |
TRKA_N dbl |
RSK_N dbl |
APP_N dbl |
Bcatenin_N dbl |
SOD1_N dbl |
MTOR_N dbl |
P38_N dbl |
pMTOR_N dbl |
DSCR1_N dbl |
AMPKA_N dbl |
NR2B_N dbl |
pNUMB_N dbl |
RAPTOR_N dbl |
TIAM1_N dbl |
pP70S6_N dbl |
NUMB_N dbl |
P70S6_N dbl |
pGSK3B_N dbl |
pPKCG_N dbl |
CDK5_N dbl |
S6_N dbl |
ADARB1_N dbl |
AcetylH3K9_N dbl |
RRP1_N dbl |
BAX_N dbl |
ARC_N dbl |
ERBB4_N dbl |
nNOS_N dbl |
Tau_N dbl |
GFAP_N dbl |
GluR3_N dbl |
GluR4_N dbl |
IL1B_N dbl |
P3525_N dbl |
pCASP9_N dbl |
PSD95_N dbl |
SNCA_N dbl |
Ubiquitin_N dbl |
pGSK3B_Tyr216_N dbl |
SHH_N dbl |
BAD_N dbl |
BCL2_N dbl |
pS6_N dbl |
pCFOS_N dbl |
SYP_N dbl |
H3AcK18_N dbl |
EGR1_N dbl |
H3MeK4_N dbl |
CaNA_N dbl |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3420_14 | 0.2295362 | 0.3843793 | 0.3359482 | 1.893929 | 2.663711 | 0.2854707 | 0.2476126 | 4.316508 | 0.2738745 | 1.413711 | 0.3502729 | 0.3925648 | 0.3110505 | 0.3325375 | 0.7288540 | 1.0088677 | 1.352660 | 1.194748 | 0.4737381 | 0.6330150 | 0.3250341 | 0.4331514 | 0.2752387 | 0.941678 | 1.361869 | 0.8489086 | 0.2592087 | 0.3011596 | 0.6091405 | 0.2302183 | 0.3639154 | 1.570941 | 0.6821282 | 0.4965894 | 0.5303547 | 0.8932469 | 0.6811050 | 0.3465211 | 0.6306276 | 0.3574352 | 0.4004093 | 0.3772169 | 0.4662347 | 0.1480992 | 0.8403306 | 0.1778512 | 1.930578 | 0.1811570 | 0.2667769 | 1.146446 | 0.2066116 | 0.2614876 | 0.1685950 | 0.1295868 | 0.1788430 | 0.1742149 | 0.2122314 | 0.1523967 | 0.2109091 | 0.0942149 | 0.8423141 | 0.3474380 | 2.322314 | 2.553058 | 0.2366942 | 1.732893 | 0.9213223 | 0.3147107 | NA | NA | 0.1295868 | 0.2565289 | 0.5576860 | 0.3454545 | NA | NA | 1.196364 | Control | Memantine | S/C | c-SC-m |
| 50810A_1 | 0.4881485 | 0.8672636 | 0.4385041 | 3.174743 | 4.158349 | 0.2057545 | 0.2028575 | 2.522979 | 0.2948380 | 1.441072 | 0.8847775 | 0.3774691 | 0.4076903 | 0.3078746 | 1.1045562 | 1.1848170 | 2.245523 | 2.386423 | 0.4309982 | 0.9236239 | 0.3325652 | 0.3791151 | 0.1958125 | 2.658019 | 4.180932 | 1.4288912 | 0.2921385 | 0.3907032 | 0.9341585 | 0.1949565 | 0.4581248 | 3.011391 | 0.3738478 | 0.4870951 | 0.4511456 | 0.8756913 | 0.5021728 | 0.4751778 | 0.5950751 | 0.4124967 | 0.3076771 | 0.4814986 | 0.2313010 | 0.3165753 | 1.6799532 | 0.2532101 | 1.245096 | 0.4141955 | 0.7393868 | 1.240746 | 0.1093730 | 0.1947802 | 0.2166548 | 0.1386089 | 0.1876699 | 0.2607386 | 0.1814798 | 0.1447154 | 0.2858338 | 0.1874608 | 0.5735497 | 0.3517504 | 2.454892 | 2.503200 | 0.1558827 | 1.216613 | 1.0035551 | 0.2533774 | 0.1550044 | 0.1476850 | 0.1386089 | 0.1500690 | 0.7595884 | 0.1483124 | 0.1650006 | 0.1867498 | 2.077084 | Control | Saline | C/S | c-CS-s |
| 50810A_2 | 0.4354220 | 0.8313117 | 0.4191440 | 2.987430 | 3.968701 | 0.1933882 | 0.2067123 | 2.352209 | 0.2939476 | 1.393187 | 0.8817799 | 0.3580542 | 0.3979637 | 0.3175790 | 1.0576331 | 1.1102382 | 2.062095 | 2.284206 | 0.4153730 | 0.8756835 | 0.3214129 | 0.3670417 | 0.1847778 | 2.524480 | 3.766451 | 1.2825090 | 0.2811891 | 0.3677330 | 0.8855509 | 0.1756018 | 0.4402615 | 2.795047 | 0.3505751 | 0.4626988 | 0.3819370 | 0.8191188 | 0.4962604 | 0.4457294 | 0.5760794 | 0.3882220 | 0.2908051 | 0.4562253 | 0.2179624 | 0.3064755 | 1.6075684 | 0.2443093 | 1.234654 | 0.3953077 | 0.7156710 | 1.128277 | 0.1097872 | 0.1908949 | 0.2080697 | 0.1409730 | 0.1856767 | 0.2602925 | 0.1685841 | 0.1462322 | 0.2811653 | 0.1809927 | 0.5739584 | 0.3440710 | 2.403115 | 2.530611 | 0.1687485 | 1.234120 | 1.0073137 | 0.2577451 | 0.1523133 | 0.1597502 | 0.1409730 | 0.1452872 | 0.7406525 | 0.1609828 | 0.1891281 | 0.1637768 | 1.963432 | Control | Saline | C/S | c-CS-s |
| 50810A_3 | 0.4136435 | 0.7912498 | 0.4016512 | 2.889177 | 3.806858 | 0.1885621 | 0.1807280 | 2.248283 | 0.3057732 | 1.321080 | 0.8312643 | 0.3380740 | 0.3679041 | 0.2703989 | 1.0279017 | 1.0762324 | 2.032120 | 2.243642 | 0.3883934 | 0.8290346 | 0.3067976 | 0.3527781 | 0.1771725 | 2.393154 | 3.820718 | 1.2399060 | 0.2686513 | 0.3576594 | 0.8547668 | 0.1727130 | 0.4163553 | 2.697843 | 0.3430758 | 0.4338918 | 0.3569965 | 0.7841388 | 0.4714957 | 0.4226226 | 0.5488731 | 0.3598891 | 0.2722068 | 0.4374473 | 0.2042907 | 0.3052795 | 1.5755662 | 0.2277986 | 1.305402 | 0.3834936 | 0.7287355 | 1.165187 | 0.1072185 | 0.1851882 | 0.2109744 | 0.1337380 | 0.1911765 | 0.2529738 | 0.1780593 | 0.1402966 | 0.2948916 | 0.1862474 | 0.5672560 | 0.3589702 | 2.379379 | 2.484764 | 0.1578133 | 1.237086 | 1.0220792 | 0.2486557 | 0.1480365 | 0.1487290 | 0.1337380 | 0.1385856 | 0.7221362 | 0.1409076 | 0.1791592 | 0.1566726 | 2.024808 | Control | Saline | C/S | c-CS-s |
| 50810A_4 | 0.3600464 | 0.6400364 | 0.3548307 | 2.699478 | 4.402931 | 0.2106962 | 0.1717030 | 2.901565 | 0.2272539 | 1.164914 | 0.6811822 | 0.3307393 | 0.3759417 | 0.2709661 | 0.9158871 | 0.9795513 | 1.933687 | 2.232718 | 0.4766951 | 0.7734912 | 0.2701383 | 0.3371140 | 0.1634241 | 1.739548 | 3.440434 | 1.3392665 | 0.2514281 | 0.3252753 | 0.8003146 | 0.1537379 | 0.3813230 | 2.543174 | 0.3090488 | 0.4282639 | 0.3742032 | 0.7936087 | 0.4825731 | 0.3795016 | 0.5368822 | 0.3617021 | 0.2734498 | 0.3912576 | 0.2045699 | 0.2809826 | 1.4262243 | 0.2269172 | 1.651199 | 0.4062779 | 0.6088919 | 1.247021 | 0.1025143 | 0.1847147 | 0.2150543 | 0.1337463 | 0.1798331 | 0.2559971 | 0.1764212 | 0.1388379 | 0.3046559 | 0.1889140 | 0.5641699 | 0.3257572 | 2.586216 | 2.465277 | 0.1479712 | 1.307700 | 0.9955383 | 0.2398824 | 0.1468164 | 0.1328014 | 0.1337463 | 0.1453992 | 0.5572411 | 0.1258202 | 0.1608315 | 0.1640859 | 2.068763 | Control | Saline | C/S | c-CS-s |
| 50810A_5 | 0.3663776 | 0.6423766 | 0.3448164 | 2.688741 | 4.172732 | 0.2096944 | 0.1646267 | 2.844289 | 0.2396855 | 1.140553 | 0.6505633 | 0.3290103 | 0.3683229 | 0.2571128 | 0.9310205 | 0.9391262 | 1.880117 | 2.085920 | 0.4599984 | 0.7416714 | 0.2618951 | 0.3282808 | 0.1592770 | 1.750344 | 3.361757 | 1.2805382 | 0.2481154 | 0.3407636 | 0.7752290 | 0.1507660 | 0.3667018 | 2.417768 | 0.3008835 | 0.4124990 | 0.3434384 | 0.7497771 | 0.4651050 | 0.3787793 | 0.5188457 | 0.3627300 | 0.2627057 | 0.3850207 | 0.2024803 | 0.2691700 | 1.3581291 | 0.2143985 | 1.560605 | 0.3834004 | 0.5993275 | 1.074031 | 0.1033270 | 0.1792429 | 0.2117491 | 0.1328272 | 0.1813318 | 0.2430835 | 0.1649259 | 0.1426097 | 0.2932185 | 0.1854079 | 0.5847047 | 0.3447802 | 2.531411 | 2.535996 | 0.1543282 | 1.259540 | 1.0195139 | 0.2414531 | 0.1389413 | 0.1255413 | 0.1328272 | 0.1374637 | 0.5304428 | 0.1355785 | 0.1756254 | 0.1536149 | 2.115555 | Control | Saline | C/S | c-CS-s |
| 50810A_6 | 0.3614875 | 0.5740795 | 0.3106038 | 2.393446 | 3.940574 | 0.1854934 | 0.1494845 | 2.576362 | 0.2126657 | 1.096245 | 0.5949926 | 0.2953608 | 0.3343888 | 0.2335788 | 0.8557437 | 0.8695876 | 1.653755 | 2.033800 | 0.4104566 | 0.6837261 | 0.2379234 | 0.2974963 | 0.1448454 | 1.668630 | 3.048822 | 1.2189249 | 0.2221649 | 0.2864507 | 0.7020619 | 0.1392489 | 0.3455817 | 2.284757 | 0.2701767 | 0.3740059 | 0.2911635 | 0.6865979 | 0.4427099 | 0.3336524 | 0.4701767 | 0.3154639 | 0.2322533 | 0.3476436 | 0.1790133 | 0.2664596 | 1.4208839 | 0.2132478 | 1.586131 | 0.3800481 | 0.6130875 | 1.015583 | 0.0972041 | 0.1759695 | 0.2080369 | 0.1267662 | 0.1831847 | 0.2431105 | 0.1716605 | 0.1300230 | 0.2975248 | 0.1791262 | 0.5724020 | 0.3221766 | 2.510121 | 2.738902 | 0.1456559 | 1.222768 | 1.0239503 | 0.2383004 | 0.1326285 | 0.1259645 | 0.1267662 | 0.1271169 | 0.5402846 | 0.1229081 | 0.1570799 | 0.1481611 | 2.015833 | Control | Saline | C/S | c-CS-s |
It seems that in this selection of mice most are treated with Saline.
Select rows with duplicate MouseIDs. Are there any duplicate MouseIDs?
## # A tibble: 0 × 82
## # Groups: MouseID [0]
## # ℹ 82 variables: MouseID <chr>, DYRK1A_N <dbl>, ITSN1_N <dbl>, BDNF_N <dbl>,
## # NR1_N <dbl>, NR2A_N <dbl>, pAKT_N <dbl>, pBRAF_N <dbl>, pCAMKII_N <dbl>,
## # pCREB_N <dbl>, pELK_N <dbl>, pERK_N <dbl>, pJNK_N <dbl>, PKCA_N <dbl>,
## # pMEK_N <dbl>, pNR1_N <dbl>, pNR2A_N <dbl>, pNR2B_N <dbl>, pPKCAB_N <dbl>,
## # pRSK_N <dbl>, AKT_N <dbl>, BRAF_N <dbl>, CAMKII_N <dbl>, CREB_N <dbl>,
## # ELK_N <dbl>, ERK_N <dbl>, GSK3B_N <dbl>, JNK_N <dbl>, MEK_N <dbl>,
## # TRKA_N <dbl>, RSK_N <dbl>, APP_N <dbl>, Bcatenin_N <dbl>, SOD1_N <dbl>, …
There are no duplicates!
Select the following columns: MouseID, APP_N, NR1_N, pCREB_N, S6_N, and Genotype.
df %>%
select(MouseID, APP_N, NR1_N, pCREB_N, S6_N, Genotype) %>%
slice_head(n = 6) %>%
formatted_table()|
MouseID chr |
APP_N dbl |
NR1_N dbl |
pCREB_N dbl |
S6_N dbl |
Genotype chr |
|---|---|---|---|---|---|
| 309_1 | 0.4539098 | 2.816329 | 0.2322238 | 0.3546045 | Control |
| 309_2 | 0.4309403 | 2.789514 | 0.2269721 | 0.3545483 | Control |
| 309_3 | 0.4231873 | 2.687201 | 0.2302468 | 0.3860868 | Control |
| 309_4 | 0.4106149 | 2.466947 | 0.2070042 | 0.2906795 | Control |
| 309_5 | 0.3985498 | 2.365785 | 0.1921579 | 0.3093450 | Control |
| 309_6 | 0.3910472 | 2.385939 | 0.1951875 | 0.3323671 | Control |
Select everything but the columns with relative expression measurements.
|
MouseID chr |
Genotype chr |
Treatment chr |
Behavior chr |
class chr |
|---|---|---|---|---|
| 309_1 | Control | Memantine | C/S | c-CS-m |
| 309_2 | Control | Memantine | C/S | c-CS-m |
| 309_3 | Control | Memantine | C/S | c-CS-m |
| 309_4 | Control | Memantine | C/S | c-CS-m |
| 309_5 | Control | Memantine | C/S | c-CS-m |
| 309_6 | Control | Memantine | C/S | c-CS-m |
Exercise 5
Note that this exercise differs a bit from the Excel counterpart. We do not use a pivot table but the results will be similar.
Group the genotypes of the mice.
Calculate the standard deviation, average and the median of the relative
expression of the following genes: - PKCA
- RRP1
- BRAF
- JNK
Round the values to 3 decimals.
First, check whether the columns contain NA values:
proteins <- c("PKCA_N", "RRP1_N", "BRAF_N", "JNK_N") # make a selection of columns to check if there are NA values
summary(df[proteins]) # check the selected columns for NA values## PKCA_N RRP1_N BRAF_N JNK_N
## Min. :0.1914 Min. :-0.06201 Min. :0.1439 Min. :0.0463
## 1st Qu.:0.2818 1st Qu.: 0.14902 1st Qu.:0.2643 1st Qu.:0.2204
## Median :0.3130 Median : 0.16210 Median :0.3267 Median :0.2449
## Mean :0.3179 Mean : 0.16663 Mean :0.3785 Mean :0.2416
## 3rd Qu.:0.3523 3rd Qu.: 0.17741 3rd Qu.:0.4136 3rd Qu.:0.2633
## Max. :0.4740 Max. : 0.61238 Max. :2.1334 Max. :0.3872
## NA's :3 NA's :3 NA's :3
The summary gives the mean and median for these proteins. However,
this is the mean and median for all measurements (not for the groups
(Saline en Memantine treated) that we are interested in) It seems that
only the column of the RRP1 protein does not contain NA
values. This means that we have to use the na.rm = argument
to calculate the standard deviation for the other three proteins:
df %>%
group_by(Genotype) %>%
summarize("St.Dev PKCA" = round(sd(PKCA_N, na.rm = T), 3),
"Mean PKCA" = round(mean(PKCA_N, na.rm = T), 3),
"Median PKCA" = round(median(PKCA_N, na.rm = T), 3),
"SD.Dev RRP1" = round(sd(RRP1_N), 3),
"Mean RRP1" = round(mean(RRP1_N, na.rm = T), 3),
"Median RRP1" = round(median(RRP1_N, na.rm = T), 3),
"SD.Dev BRAF" = round(sd(BRAF_N, na.rm = T), 3),
"Mean BRAF" = round(mean(BRAF_N, na.rm = T), 3),
"Median BRAF" = round(median(BRAF_N, na.rm = T), 3),
"SD.Dev JNK" = round(sd(JNK_N, na.rm = T), 3),
"Mean JNK" = round(mean(JNK_N, na.rm = T), 3),
"Median JNK" = round(median(JNK_N, na.rm = T), 3)
) %>%
formatted_table()|
Genotype chr |
St.Dev PKCA dbl |
Mean PKCA dbl |
Median PKCA dbl |
SD.Dev RRP1 dbl |
Mean RRP1 dbl |
Median RRP1 dbl |
SD.Dev BRAF dbl |
Mean BRAF dbl |
Median BRAF dbl |
SD.Dev JNK dbl |
Mean JNK dbl |
Median JNK dbl |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Control | 0.048 | 0.318 | 0.312 | 0.034 | 0.165 | 0.159 | 0.265 | 0.371 | 0.302 | 0.036 | 0.241 | 0.247 |
| Ts65Dn | 0.057 | 0.318 | 0.315 | 0.029 | 0.169 | 0.164 | 0.143 | 0.387 | 0.353 | 0.031 | 0.243 | 0.244 |
Go back to the main page
Go back to the R overview page
⬆️ Back to Top
This web page is distributed under the terms of the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. Creative Commons License: CC BY-SA 4.0.