This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find os: | |
```{r} | |
os <- Sys.info()[[1]] | |
``` | |
# Create OS-relevant Dropbox file path: | |
```{r} | |
if(os == "Windows"){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preview dataframe to write beforehands: | |
head(my_fav_df) | |
# Check dimensions of the dataframe you wish to write in a .csv file: | |
dim(my_fav_df) | |
# Set path of (i)output directory (ii) filename: | |
savedir = "home/cgpu/favorite_dir/" | |
FILE = paste0(savedir, 'favorite_filename', '.csv') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 3 relevant packages: | |
## Basic, | |
```{r} | |
utils::sessionInfo() | |
``` | |
## Slightly cooler, nicer output display | |
## DWNL: https://github.com/r-lib/sessioninfo | |
```{r} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
names_to_keep <- c('item1', 'item2', 'etc') | |
df_sliced <- df[is.element(df$name , names_to_keep ), ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# TO RUN JUST TYPE: | |
# python3 snp_selection.py | |
# INPUT FILES AND OPTIONS WILL BE REQUESTED AS USER INPUT | |
# THE FOLLOWING PROGRAMME IS PART OF the PACtool package (https://pypi.python.org/pypi/PACtool) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Highlighting errors, warnings, messages | |
Color code what R tells you when you need to knw something about your code. | |
This cool snippet found here: https://selbydavid.com/2017/06/18/rmarkdown-alerts/<br> | |
Kuddos to [David](https://twitter.com/TeaStats) for sharing! | |
```{r echo=FALSE} | |
# Cool snippet for color coding errors | |
knitr::knit_hooks$set( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://rmarkdown.rstudio.com/word_document_format | |
``` | |
--- | |
title: "From rmd to word document" | |
date: "`r Sys.Date()`" | |
output: | |
word_document: | |
toc : TRUE #to include a table of contents in the output | |
toc_depth : 3 # Depth of headers to include in table of contents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# installing/loading the package: | |
if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr | |
# Installing pandoc | |
install.pandoc() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: 'My very favorite title' | |
date: "`r Sys.Date()`" | |
output: | |
word_document: | |
toc : TRUE #to include a table of contents in the output | |
toc_depth : 3 # Depth of headers to include in table of contents | |
fig_width : # Default width (in inches) for figures | |
fig_height : # Default width (in inches) for figures | |
fig_caption : TRUE #to render figures with captions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dataframe with the aliquot IDs of the cohort's samples, 96 x 4 | |
aliquot_ID <- data.frame(matrix(NA, nrow = length(ofsthelse), ncol = length(LCMS_id))) | |
colnames(aliquot_ID) <- LCMS_id |
OlderNewer