copy file to box so that the analysis can be reproducible
Code
## - [ ] clean up this part. Create function that creates the foldersuppressMessages(library(tidyverse))suppressMessages(library(glue))PRE ="/Users/haekyungim/Library/CloudStorage/Box-Box/LargeFiles/imlab-data/data-Github/web-data"##PRE="/Users/margaretperry/Library/CloudStorage/Box-Box/imlab-data/data-Github/web-data "##PRE="/Users/temi/Library/CloudStorage/Box-Box/imlab-data/data-Github/web-data"## COPY THE DATE AND SLUG fields FROM THE HEADERSLUG="predictdb-weight-distribution"## copy the slug from the headerbDATE='2023-02-28'## copy the date from the blog's header hereDATA =glue("{PRE}/{bDATE}-{SLUG}")if(!file.exists(DATA)) system(glue::glue("mkdir {DATA}"))WORK=DATA## move data to DATA#tempodata=("~/Downloads/tempo/gwas_catalog_v1.0.2-associations_e105_r2022-04-07.tsv")#system(glue::glue("cp {tempodata} {DATA}/"))#system(glue("open {DATA}")) ## this will open the folder
---title: "How to create a new quarto blog post"author: "Haky Im"date: "2023-01-01"categories: [how_to]---- [ ] create a new folder under post/new_folder- [ ] name the folder with year-month-date-slug, 2023-03-02-descriptive-title- [ ] create a file named index.qmd and add the following header, update the title, your name and the date``` ---title: "Your Title"author: "Your Name"date: "2023-02-28"date-modified: last-modifiedcategories: [analysis,how_to]format: html: code-fold: true code-summary: "Show the code" code-tools: true code-overflow: wrapeditor_options: chunk_output_type: console---```- [ ] copy file to box so that the analysis can be reproducible```{r eval=FALSE}## - [ ] clean up this part. Create function that creates the foldersuppressMessages(library(tidyverse))suppressMessages(library(glue))PRE ="/Users/haekyungim/Library/CloudStorage/Box-Box/LargeFiles/imlab-data/data-Github/web-data"##PRE="/Users/margaretperry/Library/CloudStorage/Box-Box/imlab-data/data-Github/web-data "##PRE="/Users/temi/Library/CloudStorage/Box-Box/imlab-data/data-Github/web-data"## COPY THE DATE AND SLUG fields FROM THE HEADERSLUG="predictdb-weight-distribution"## copy the slug from the headerbDATE='2023-02-28'## copy the date from the blog's header hereDATA =glue("{PRE}/{bDATE}-{SLUG}")if(!file.exists(DATA)) system(glue::glue("mkdir {DATA}"))WORK=DATA## move data to DATA#tempodata=("~/Downloads/tempo/gwas_catalog_v1.0.2-associations_e105_r2022-04-07.tsv")#system(glue::glue("cp {tempodata} {DATA}/"))#system(glue("open {DATA}")) ## this will open the folder ```## other linksUseful tips for new posts [here](https://samanthacsik.github.io/posts/2022-10-24-quarto-blogs/#vi.-a-note-on-adding-an-additional-blog-or-more-to-your-site)## functions```{r eval=FALSE}## input: date, title, slugREPO="/Users/haekyungim/Github/web-lab-notes-quarto"bDATE=format(Sys.time(),"%Y-%m-%d")SLUG="test 1 lsdkf"new_post =function(repo=REPO,slug=SLUG,bdate=bDATE){ slug =tolower(gsub(" ", "-", slug) ) FOLDERNAME = glue::glue("{repo}/posts/{bdate}-{slug}")if(!file.exists(FOLDERNAME)) {system(glue::glue("mkdir {FOLDERNAME}"))system(glue::glue("touch {FOLDERNAME}/index.qmd"))system(glue::glue("echo --- >> {FOLDERNAME}/index.qmd"))system(glue::glue("echo 'title: {slug}' >> {FOLDERNAME}/index.qmd"))system(glue::glue("echo 'author: AUTHOR NAME HERE' >> {FOLDERNAME}/index.qmd"))system(glue::glue("echo 'date: {bdate}' >> {FOLDERNAME}/index.qmd"))system(glue::glue("echo --- >> {FOLDERNAME}/index.qmd")) } else {warning("{bdate}-{slug} already exists; you may want to change the slug")}}```