diff --git a/_freeze/projects/project-0/index/execute-results/html.json b/_freeze/projects/project-0/index/execute-results/html.json index 6a68c52..36c9f6e 100644 --- a/_freeze/projects/project-0/index/execute-results/html.json +++ b/_freeze/projects/project-0/index/execute-results/html.json @@ -1,7 +1,7 @@ { - "hash": "db0b266029268c99b83b47c7e740ff78", + "hash": "6f62c8280661cf318b53b7fd17bab6bf", "result": { - "markdown": "---\ntitle: \"Project 0 (optional)\"\nauthor:\n - name: Leonardo Collado Torres\n url: http://lcolladotor.github.io/\n affiliations:\n - id: libd\n name: Lieber Institute for Brain Development\n url: https://libd.org/\n - id: jhsph\n name: Johns Hopkins Bloomberg School of Public Health Department of Biostatistics\n url: https://publichealth.jhu.edu/departments/biostatistics\ndescription: \"Information for Project 0 (entirely optional, but hopefully useful and fun!)\"\ncategories: [project 0, projects]\n---\n\n\n*This project, as the rest of the course, is adapted from the version [Stephanie C. Hicks](https://www.stephaniehicks.com/) designed and maintained in 2021 and 2022. Check the recent changes to this file through the [GitHub history](https://github.com/lcolladotor/jhustatcomputing2023/commits/main/projects/project-0/index.qmd).*\n\n# Background\n\n**Due date: Sept 10 at 11:59pm**\n\nUsing the tools we learned in the first week (e.g. R, RStudio and Github). Let's apply them in a small (but also comprehensive) exercise.\n\n- **Please note this project is entirely optional** (i.e. it will not be graded), but hopefully it will be helpful to you getting set up for the rest of the course (i.e. set up these tools on your computing environment) and give you an opportunity to introduce yourself to your classmates.\n\n- **For those of you who are new to GitHub/R/Rmarkdown**: this project makes you do a lot of things that you might not be familiar with. I know that this might be time-consuming and also might feel a bit intimidating. It's partly unavoidable and partly on purpose. You need to learn how to quickly get up to speed with all kinds of new tools that come your way. So practicing it is a good idea. You are welcome to draw on any sources for help that you want (online, classmates, instructor, etc.). I'm confident with a bit of trial and error you'll get it to work.\n\n# R package dependencies\n\nYou will likely need to install these R packages:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ninstall.packages(\n c(\"postcards\", \"usethis\", \"gitcreds\")\n)\n```\n:::\n\n\nYou will also need to have installed Git on your computer. Follow for more detailed instructions depending on your operating system.\n\n# Part 1\n\nThis part of the project is to ensure that you have successfully set up your computing environment. Please email (use the Subject line: `140.776 Setup`) the Course Instructor (Dr. Leonardo Collado Torres) at lcollado\\@jhu.edu the following information:\n\n### Setting up your computing environment\n\n1. Your name, JHED ID (if applicable).\n\n2. The type of computer/operating system you are using (Windows, Mac, Unix/Linux, other)\n\n3. The version of R that you have installed on your computer. To do this, start up R and run the following in the R console and include the output in your email.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprint(R.version.string)\n```\n:::\n\n\n![Printing the R version string](../../videos/versionstring.gif)\n\n4. The version of RStudio that you have installed on your computer. To do this start up RStudio and in the R console window, run the following and again include the output in your email:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprint(RStudio.Version()$version)\n```\n:::\n\n\n5. If you have a GitHub username, please include this in your email. If you do not have a GitHub username, read https://happygitwithr.com, sign up for GitHub, and include your new username in your email to me.\n\n6. To make sure git is installed on your system, use the 'Terminal' (e.g. it's next to the R Console within RStudio) (or whatever you use), run the following and include the output in your email:\n\nFor example, this is mine:\n\n\n::: {.cell}\n\n```{.bash .cell-code}\ngit --version\n```\n\n\n::: {.cell-output .cell-output-stdout}\n```\ngit version 2.39.2 (Apple Git-143)\n```\n:::\n:::\n\n\nIf you have any trouble with any of the steps above, try to first post on the discussion board on CoursePlus. The TAs and I will be checking it frequently, but other students may also be helpful in their replies. You can also use other resources to get help (Google, R4DS, colleagues/friends/relatives with R/Markdown experience, etc.). Still, try to do as much as possible yourself. We will use all the bits you are learning here repeatedly during this course.\n\n# Part 2: make a website using `usethis` and `postcards`\n\nThis part of the project is to help you introduce yourself (and your interests!) to others in this course. You will create a new GitHub repository and build a small website about yourself.\n\n\n\n\n\n### 1. Create an RStudio project for your website\n\nUse `usethis::create_project()` or in RStudio go to `File` -\\> `New project` and create a project with the name `.github.io`. That is a very specific name used by GitHub Pages .\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## My GitHub username is \"lcolladotor\", so this would create the RStudio project\n## on my Desktop\nusethis::create_project(\"~/Desktop/lcolladotor.github.io\")\n```\n:::\n\n\nIf you already have a GitHub repository with that name, then choose the following name: `biostat776-intro--` (where you replace `` with your first name and `` with your last name) in your own personal GitHub account.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nusethis::create_project(\"~/Desktop/biostat776-intro-Leonardo-ColladoTorres\")\n```\n:::\n\n\n`usethis::create_project()` will create a new RStudio window for your website project.\n\n### 2. Create a local Git repo for your RStudio project\n\nWe will use utilities from `usethis` to link our RStudio project to GitHub. Assuming that you already have Git installed in your computer (see for detailed instructions on how to install Git), on your RStudio project you made on step 1 above type this on your R console: `usethis::use_git()`. This will run `git init` behind the scenes and setup a Git repository on your computer. On your R console you will get asked if it's OK to restart RStudio. Say yes, as that will now enable the `Git` panel in RStudio, which will make your life easier later on.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nusethis::use_git() ## Choose the option to make the commit, then to restart RStudio\n## If you don't have git installed, you will likely benefit from reading\n## \"Happy Git and GitHub for the useR\" at https://happygitwithr.com/.\n```\n:::\n\n\nHere's the output and selections I made in my case. Note that the prompts and options will change randomly every time you run this function, so you do need to read them carefully!\n\n``` \nusethis::use_git()\n✔ Setting active project to '/Users/leocollado/Dropbox/Mac/Desktop/biostat776-intro-Leonardo-ColladoTorres'\n✔ Initialising Git repo\n✔ Adding '.Rhistory', '.Rdata', '.httr-oauth', '.DS_Store', '.quarto' to '.gitignore'\nThere are 2 uncommitted files:\n* '.gitignore'\n* 'biostat776-intro-Leonardo-ColladoTorres.Rproj'\nIs it ok to commit them?\n\n1: Not now\n2: Yup\n3: Negative\n\nSelection: 2\n\n✔ Adding files\n✔ Making a commit with message 'Initial commit'\n• A restart of RStudio is required to activate the Git pane\nRestart now?\n\n1: Absolutely not\n2: No\n3: For sure\n\nSelection: 3\n```\n\nAt the end, my RStudio window was restarted.\n\n### 3. Use the `gh-pages` branch\n\nGitHub provides websites for free to Git repositories they host if you use a specific Git branch name: `gh-pages`. While there are more configuration options available through GitHub, the easiest option is to use the `gh-pages` branch, which we can do with R thanks to `usethis::git_default_branch_rename()` as shown below:\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## After the restart, we next need to change the default Git branch to \"gh-pages\".\n## This will make our lives a bit easier later on, as this specific name is used by\n## GitHub pages https://pages.github.com/ for websites.\nusethis::git_default_branch_rename(to = \"gh-pages\")\n```\n:::\n\n\nThis was the output for me:\n\n``` \nusethis::git_default_branch_rename(to = \"gh-pages\")\n✔ Setting active project to '/Users/leocollado/Dropbox/Mac/Desktop/biostat776-intro-Leonardo-ColladoTorres'\nℹ Local branch 'devel' appears to play the role of the default branch.\n✔ Moving local 'devel' branch to 'gh-pages'.\n• Be sure to update files that refer to the default branch by name.\n Consider searching within your project for 'devel'.\n```\n\n### 4. Link R to GitHub\n\nWe will need to provide R the information to act on your behalf when doing things for you on GitHub. We will need to follow the instructions from `usethis::gh_token_help()` for this. This is a function from the authors of that guides you through the full process.\n\nFor most of you (aka anyone on macOS or winOS and not on Linux), you will use two functions:\n\n1. `usethis::create_github_token()` will help you create a personal access token (PAT) for GitHub. Think of it as an alternative version to your GitHub password that we can use from R.\n2. `gitcreds::gitcreds_set()` will allow you to save your PAT in a way that R will be able to access it again in the future. This function only works on macOS and winOS, but not on Linux.\n\nIf you are a Linux user, you'll have to save your GitHub PAT on your `~/.Renviron` file using `usethis::edit_r_environ()`.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## We will next link R to GitHub so R can act on your behalf. We will create a \n## GitHub Personal Access Token (PAT) so R can say that it's acting on your behalf.\n## This function guides us through the full process:\n\nusethis::gh_token_help()\n## The above command will suggest that you read more at\n## https://usethis.r-lib.org/articles/articles/git-credentials.html\n## which contains the latest recommendations by the usethis authors for\n## configuring your R to GitHub connection.\nusethis::create_github_token()\ngitcreds::gitcreds_set()\n## Type your GitHub token, not your password! Otherwise you might run into this\n## problem: https://github.com/r-lib/usethis/issues/1347\n\n## In some situations, gitcreds::gitcreds_set() might not work. For example,\n## gitcreds::gitcreds_set() is not supported on Linux as discussed at\n## https://github.com/r-lib/gitcreds/issues/29. In these situations,\n## you have to rely on the old workflow of editing your\n## .Renviron file with contents like (note the empty line at the end!):\n# GITHUB_PAT=YOUR_40_CHARACTERS_TOKEN\n#\nusethis::edit_r_environ()\n## Then re-start your R session.\nrstudioapi::restartSession()\n## Editing the .Renviron is strongly discouraged now since it stores as\n## simple text your GitHub personal access token (PAT) instead of the\n## more secure approach provided by gitcreds.\n\n## Now run use_github()\nusethis::use_github()\n```\n:::\n\n\n### 5. Create Hub repo and link your RStudio project to it\n\nNext, we can can link our local Git repository to GitHub, which is a service that hosts Git repositories. We will do this through R via the `usethis::use_github()` function. Since we configured R in step 4 to act for us when interacting with GitHub, we can now use this function on our RStudio project that we made for our website.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## Next we continue by connecting your local git repository to\n## GitHub. For other scenarios, you might want to use the `organisation`\n## and `private` arguments\nargs(usethis::use_github)\n\n## Now run use_github()\nusethis::use_github()\n```\n:::\n\n\nFollowing the prompts, you will end up with a GitHub repository that is `https://github.com//.github.io` (or alternatively `https://github.com//biostat776-intro--`).\n\nFor example, you can find an example that I created for myself at\n\n- github repo: \n\n### 6. Build a website using R Markdown\n\nUsing one of the many ways we discussed in class (e.g. a [simple R Markdown website](https://bookdown.org/yihui/rmarkdown/rmarkdown-site.html), [blogdown](https://bookdown.org/yihui/blogdown/), [distill](https://rstudio.github.io/distill/website.html), etc), create a new project in RStudio with the appropriate files. We highly recommend that you use [postcards](https://github.com/seankross/postcards) which includes easy to use R Markdown templates.\n\nOn your files, you might include the following information:\n\n- Write a short summary introducing yourself. Structure the webpage with headings, subheadings, etc. Talk a bit about yourself, your background, training, research interests. Let me/us know what kind of statistics, programming, data analysis experience you already have. I am also curious to know what you most hope to learn in this course.\n\n- Five fun facts about yourself\n\n- A web page linking to something you think is really cool/interesting/inspiring/etc. You could also describe briefly what it is and why you like it.\n\nOverall, your website should ideally say something about you, your interests, your projects, and how to contact you. Here are some examples with their source code:\n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\nIf you want, feel free to get creative and include other things. You can play with RMarkdown if you wish to, e.g., you can try to include some table or a video, etc.\n\nWith [postcards](https://github.com/seankross/postcards), explore the five templates at https://github.com/seankross/postcards and then create the files using one of the following five options:\n\n\n::: {.cell}\n\n```{.r .cell-code}\npostcards::create_postcard(template = \"jolla\")\npostcards::create_postcard(template = \"jolla-blue\")\npostcards::create_postcard(template = \"trestles\")\npostcards::create_postcard(template = \"onofre\")\npostcards::create_postcard(template = \"solana\")\n```\n:::\n\n\nI chose this one for example: `postcards::create_postcard(template = \"trestles\")`. This created two files for me: `index.Rmd` and `frank.jpg`.\n\n### 7. Render your website\n\nRender your R Markdown website. That is, create an `index.html` file. If you are using [postcards](https://github.com/seankross/postcards), simply click the `Knit` button on RStudio. This uses the information from `index.Rmd` to create the `index.html` file.\n\n### 8. Deploy your website\n\nDepending on how you want to deploy your website, the following may or may not be relevant to you.\n\nWith [postcards](https://github.com/seankross/postcards), we will version control with Git the 3 files we made: `index.Rmd`, `index.html`, and `frank.jpg` (or whichever image it was for you). We can do this with the RStudio `Git` panel where we will click on `Commit`, then select all 3 files so we can `Add` them to `Git`, then type a message for our `commit`. I typed \"Initial postcards website\" in my case as you can see at . Then click on `Push` to upload these files to GitHub.\n\nA few seconds / 1-2 minutes later, your website should be visible to the public. Mine is available at . If your RStudio project name is\n\n- `.github.io` then your website will be available at `https://.github.io`.\n\n- `biostat776--` then your website will be available at `https://.github.io/biostat776--`.\n\n### 9. Refine your website\n\nNow that you have a website, feel free to edit your `index.Rmd` file as well as to change your image (either save it as `frank.jpg` or save a new image but also update the corresponding line on your `index.Rmd`). Remember to use `Knit` on RStudio to update the `index.html` file then use the `Git` panel to select the files you edited prior to making a `git commit` to version control the changes. Finally, use `git push` to upload the new version of your files to GitHub.\n\nYou might also want to use inline R code with `fontawesome::fa()` like at or and emojis like at . Check all previous examples I linked to, though these ones have some more advanced features:\n\n- + \n\n- + \n\n- + \n\n### 10. Share your website\n\n- Go to the Discussion Board in CoursePlus and write a short post with a link (URL) to your website (and URL to the corresponding GitHub repository) that you created.\n- As you read the introductions from other folks in the class, feel free to comment/reply using Discussion board.\n- Feel free to share your website with the world. If you use Twitter, use the `#postcards` hashtag and tag the author `@seankross` .\n\nIn class on Sept 12, I will show as many websites as I can from Courseplus!\n\n# R session information\n\n\n::: {.cell}\n\n```{.r .cell-code}\noptions(width = 120)\nsessioninfo::session_info()\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────\n setting value\n version R version 4.3.1 (2023-06-16)\n os macOS Ventura 13.5\n system aarch64, darwin20\n ui X11\n language (EN)\n collate en_US.UTF-8\n ctype en_US.UTF-8\n tz America/Mexico_City\n date 2023-08-28\n pandoc 3.1.5 @ /opt/homebrew/bin/ (via rmarkdown)\n\n─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n package * version date (UTC) lib source\n cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)\n colorout 1.2-2 2023-05-06 [1] Github (jalvesaq/colorout@79931fd)\n digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0)\n evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.0)\n fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)\n htmltools 0.5.6 2023-08-10 [1] CRAN (R 4.3.0)\n htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.0)\n jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.0)\n knitr 1.43 2023-05-25 [1] CRAN (R 4.3.0)\n rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)\n rmarkdown 2.24 2023-08-14 [1] CRAN (R 4.3.1)\n rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)\n sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)\n xfun 0.40 2023-08-09 [1] CRAN (R 4.3.0)\n yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)\n\n [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library\n\n──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n```\n:::\n:::\n", + "markdown": "---\ntitle: \"Project 0 (optional)\"\nauthor:\n - name: Leonardo Collado Torres\n url: http://lcolladotor.github.io/\n affiliations:\n - id: libd\n name: Lieber Institute for Brain Development\n url: https://libd.org/\n - id: jhsph\n name: Johns Hopkins Bloomberg School of Public Health Department of Biostatistics\n url: https://publichealth.jhu.edu/departments/biostatistics\ndescription: \"Information for Project 0 (entirely optional, but hopefully useful and fun!)\"\ncategories: [project 0, projects]\n---\n\n\n*This project, as the rest of the course, is adapted from the version [Stephanie C. Hicks](https://www.stephaniehicks.com/) designed and maintained in 2021 and 2022. Check the recent changes to this file through the [GitHub history](https://github.com/lcolladotor/jhustatcomputing2023/commits/main/projects/project-0/index.qmd).*\n\n# Background\n\n**Due date: Sept 10 at 11:59pm**\n\nUsing the tools we learned in the first week (e.g. R, RStudio and Github). Let's apply them in a small (but also comprehensive) exercise.\n\n- **Please note this project is entirely optional** (i.e. it will not be graded), but hopefully it will be helpful to you getting set up for the rest of the course (i.e. set up these tools on your computing environment) and give you an opportunity to introduce yourself to your classmates.\n\n- **For those of you who are new to GitHub/R/Rmarkdown**: this project makes you do a lot of things that you might not be familiar with. I know that this might be time-consuming and also might feel a bit intimidating. It's partly unavoidable and partly on purpose. You need to learn how to quickly get up to speed with all kinds of new tools that come your way. So practicing it is a good idea. You are welcome to draw on any sources for help that you want (online, classmates, instructor, etc.). I'm confident with a bit of trial and error you'll get it to work.\n\n# R package dependencies\n\nYou will likely need to install these R packages:\n\n\n::: {.cell}\n\n```{.r .cell-code}\ninstall.packages(\n c(\"postcards\", \"usethis\", \"gitcreds\")\n)\n```\n:::\n\n\nYou will also need to have installed Git on your computer. Follow for more detailed instructions depending on your operating system.\n\n# Part 1\n\nThis part of the project is to ensure that you have successfully set up your computing environment. Please email (use the Subject line: `140.776 Setup`) the Course Instructor (Dr. Leonardo Collado Torres) at lcollado\\@jhu.edu the following information:\n\n### Setting up your computing environment\n\n1. Your name, JHED ID (if applicable).\n\n2. The type of computer/operating system you are using (Windows, Mac, Unix/Linux, other)\n\n3. The version of R that you have installed on your computer. To do this, start up R and run the following in the R console and include the output in your email.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprint(R.version.string)\n```\n:::\n\n\n![Printing the R version string](../../videos/versionstring.gif)\n\n4. The version of RStudio that you have installed on your computer. To do this start up RStudio and in the R console window, run the following and again include the output in your email:\n\n\n::: {.cell}\n\n```{.r .cell-code}\nprint(RStudio.Version()$version)\n```\n:::\n\n\n5. If you have a GitHub username, please include this in your email. If you do not have a GitHub username, read https://happygitwithr.com, sign up for GitHub, and include your new username in your email to me.\n\n6. To make sure git is installed on your system, use the 'Terminal' (e.g. it's next to the R Console within RStudio) (or whatever you use), run the following and include the output in your email:\n\nFor example, this is mine:\n\n\n::: {.cell}\n\n```{.bash .cell-code}\ngit --version\n```\n\n\n::: {.cell-output .cell-output-stdout}\n```\ngit version 2.39.2 (Apple Git-143)\n```\n:::\n:::\n\n\nIf you have any trouble with any of the steps above, try to first post on the discussion board on CoursePlus. The TAs and I will be checking it frequently, but other students may also be helpful in their replies. You can also use other resources to get help (Google, R4DS, colleagues/friends/relatives with R/Markdown experience, etc.). Still, try to do as much as possible yourself. We will use all the bits you are learning here repeatedly during this course.\n\n# Part 2: make a website using `usethis` and `postcards`\n\nThis part of the project is to help you introduce yourself (and your interests!) to others in this course. You will create a new GitHub repository and build a small website about yourself.\n\n\n\n\n\n### 1. Create an RStudio project for your website\n\nUse `usethis::create_project()` or in RStudio go to `File` -\\> `New project` and create a project with the name `.github.io`. That is a very specific name used by GitHub Pages .\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## My GitHub username is \"lcolladotor\", so this would create the RStudio project\n## on my Desktop\nusethis::create_project(\"~/Desktop/lcolladotor.github.io\")\n```\n:::\n\n\nIf you already have a GitHub repository with that name, then choose the following name: `biostat776-intro--` (where you replace `` with your first name and `` with your last name) in your own personal GitHub account.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nusethis::create_project(\"~/Desktop/biostat776-intro-Leonardo-ColladoTorres\")\n```\n:::\n\n\n`usethis::create_project()` will create a new RStudio window for your website project.\n\n### 2. Create a local Git repo for your RStudio project\n\nWe will use utilities from `usethis` to link our RStudio project to GitHub. Assuming that you already have Git installed in your computer (see for detailed instructions on how to install Git), on your RStudio project you made on step 1 above type this on your R console: `usethis::use_git()`. This will run `git init` behind the scenes and setup a Git repository on your computer. On your R console you will get asked if it's OK to restart RStudio. Say yes, as that will now enable the `Git` panel in RStudio, which will make your life easier later on.\n\n\n::: {.cell}\n\n```{.r .cell-code}\nusethis::use_git() ## Choose the option to make the commit, then to restart RStudio\n## If you don't have git installed, you will likely benefit from reading\n## \"Happy Git and GitHub for the useR\" at https://happygitwithr.com/.\n```\n:::\n\n\nHere's the output and selections I made in my case. Note that the prompts and options will change randomly every time you run this function, so you do need to read them carefully!\n\n``` \nusethis::use_git()\n✔ Setting active project to '/Users/leocollado/Dropbox/Mac/Desktop/biostat776-intro-Leonardo-ColladoTorres'\n✔ Initialising Git repo\n✔ Adding '.Rhistory', '.Rdata', '.httr-oauth', '.DS_Store', '.quarto' to '.gitignore'\nThere are 2 uncommitted files:\n* '.gitignore'\n* 'biostat776-intro-Leonardo-ColladoTorres.Rproj'\nIs it ok to commit them?\n\n1: Not now\n2: Yup\n3: Negative\n\nSelection: 2\n\n✔ Adding files\n✔ Making a commit with message 'Initial commit'\n• A restart of RStudio is required to activate the Git pane\nRestart now?\n\n1: Absolutely not\n2: No\n3: For sure\n\nSelection: 3\n```\n\nAt the end, my RStudio window was restarted.\n\n### 3. Use the `gh-pages` branch\n\nGitHub provides websites for free to Git repositories they host if you use a specific Git branch name: `gh-pages`. While there are more configuration options available through GitHub, the easiest option is to use the `gh-pages` branch, which we can do with R thanks to `usethis::git_default_branch_rename()` as shown below:\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## After the restart, we next need to change the default Git branch to \"gh-pages\".\n## This will make our lives a bit easier later on, as this specific name is used by\n## GitHub pages https://pages.github.com/ for websites.\nusethis::git_default_branch_rename(to = \"gh-pages\")\n```\n:::\n\n\nThis was the output for me:\n\n``` \nusethis::git_default_branch_rename(to = \"gh-pages\")\n✔ Setting active project to '/Users/leocollado/Dropbox/Mac/Desktop/biostat776-intro-Leonardo-ColladoTorres'\nℹ Local branch 'devel' appears to play the role of the default branch.\n✔ Moving local 'devel' branch to 'gh-pages'.\n• Be sure to update files that refer to the default branch by name.\n Consider searching within your project for 'devel'.\n```\n\n### 4. Link R to GitHub\n\nWe will need to provide R the information to act on your behalf when doing things for you on GitHub. We will need to follow the instructions from `usethis::gh_token_help()` for this. This is a function from the authors of that guides you through the full process.\n\nFor most of you (aka anyone on macOS or winOS and not on Linux), you will use two functions:\n\n1. `usethis::create_github_token()` will help you create a personal access token (PAT) for GitHub. Think of it as an alternative version to your GitHub password that we can use from R.\n2. `gitcreds::gitcreds_set()` will allow you to save your PAT in a way that R will be able to access it again in the future. This function only works on macOS and winOS, but not on Linux.\n\nIf you are a Linux user, you'll have to save your GitHub PAT on your `~/.Renviron` file using `usethis::edit_r_environ()`.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## We will next link R to GitHub so R can act on your behalf. We will create a \n## GitHub Personal Access Token (PAT) so R can say that it's acting on your behalf.\n## This function guides us through the full process:\n\nusethis::gh_token_help()\n## The above command will suggest that you read more at\n## https://usethis.r-lib.org/articles/articles/git-credentials.html\n## which contains the latest recommendations by the usethis authors for\n## configuring your R to GitHub connection.\nusethis::create_github_token()\ngitcreds::gitcreds_set()\n## Type your GitHub token, not your password! Otherwise you might run into this\n## problem: https://github.com/r-lib/usethis/issues/1347\n\n## In some situations, gitcreds::gitcreds_set() might not work. For example,\n## gitcreds::gitcreds_set() is not supported on Linux as discussed at\n## https://github.com/r-lib/gitcreds/issues/29. In these situations,\n## you have to rely on the old workflow of editing your\n## .Renviron file with contents like (note the empty line at the end!):\n# GITHUB_PAT=YOUR_40_CHARACTERS_TOKEN\n#\nusethis::edit_r_environ()\n## Then re-start your R session.\nrstudioapi::restartSession()\n## Editing the .Renviron is strongly discouraged now since it stores as\n## simple text your GitHub personal access token (PAT) instead of the\n## more secure approach provided by gitcreds.\n```\n:::\n\n\n### 5. Create Hub repo and link your RStudio project to it\n\nNext, we can can link our local Git repository to GitHub, which is a service that hosts Git repositories. We will do this through R via the `usethis::use_github()` function. Since we configured R in step 4 to act for us when interacting with GitHub, we can now use this function on our RStudio project that we made for our website.\n\n\n::: {.cell}\n\n```{.r .cell-code}\n## Next we continue by connecting your local git repository to\n## GitHub. For other scenarios, you might want to use the `organisation`\n## and `private` arguments\nargs(usethis::use_github)\n\n## Now run use_github()\nusethis::use_github()\n```\n:::\n\n\nFollowing the prompts, you will end up with a GitHub repository that is `https://github.com//.github.io` (or alternatively `https://github.com//biostat776-intro--`).\n\nFor example, you can find an example that I created for myself at\n\n- github repo: \n\n### 6. Build a website using R Markdown\n\nUsing one of the many ways we discussed in class (e.g. a [simple R Markdown website](https://bookdown.org/yihui/rmarkdown/rmarkdown-site.html), [blogdown](https://bookdown.org/yihui/blogdown/), [distill](https://rstudio.github.io/distill/website.html), etc), create a new project in RStudio with the appropriate files. We highly recommend that you use [postcards](https://github.com/seankross/postcards) which includes easy to use R Markdown templates.\n\nOn your files, you might include the following information:\n\n- Write a short summary introducing yourself. Structure the webpage with headings, subheadings, etc. Talk a bit about yourself, your background, training, research interests. Let me/us know what kind of statistics, programming, data analysis experience you already have. I am also curious to know what you most hope to learn in this course.\n\n- Five fun facts about yourself\n\n- A web page linking to something you think is really cool/interesting/inspiring/etc. You could also describe briefly what it is and why you like it.\n\nOverall, your website should ideally say something about you, your interests, your projects, and how to contact you. Here are some examples with their source code:\n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\n- + \n\nIf you want, feel free to get creative and include other things. You can play with RMarkdown if you wish to, e.g., you can try to include some table or a video, etc.\n\nWith [postcards](https://github.com/seankross/postcards), explore the five templates at https://github.com/seankross/postcards and then create the files using one of the following five options:\n\n\n::: {.cell}\n\n```{.r .cell-code}\npostcards::create_postcard(template = \"jolla\")\npostcards::create_postcard(template = \"jolla-blue\")\npostcards::create_postcard(template = \"trestles\")\npostcards::create_postcard(template = \"onofre\")\npostcards::create_postcard(template = \"solana\")\n```\n:::\n\n\nI chose this one for example: `postcards::create_postcard(template = \"trestles\")`. This created two files for me: `index.Rmd` and `frank.jpg`.\n\n### 7. Render your website\n\nRender your R Markdown website. That is, create an `index.html` file. If you are using [postcards](https://github.com/seankross/postcards), simply click the `Knit` button on RStudio. This uses the information from `index.Rmd` to create the `index.html` file.\n\n### 8. Deploy your website\n\nDepending on how you want to deploy your website, the following may or may not be relevant to you.\n\nWith [postcards](https://github.com/seankross/postcards), we will version control with Git the 3 files we made: `index.Rmd`, `index.html`, and `frank.jpg` (or whichever image it was for you). We can do this with the RStudio `Git` panel where we will click on `Commit`, then select all 3 files so we can `Add` them to `Git`, then type a message for our `commit`. I typed \"Initial postcards website\" in my case as you can see at . Then click on `Push` to upload these files to GitHub.\n\nA few seconds / 1-2 minutes later, your website should be visible to the public. Mine is available at . If your RStudio project name is\n\n- `.github.io` then your website will be available at `https://.github.io`.\n\n- `biostat776--` then your website will be available at `https://.github.io/biostat776--`.\n\n### 9. Refine your website\n\nNow that you have a website, feel free to edit your `index.Rmd` file as well as to change your image (either save it as `frank.jpg` or save a new image but also update the corresponding line on your `index.Rmd`). Remember to use `Knit` on RStudio to update the `index.html` file then use the `Git` panel to select the files you edited prior to making a `git commit` to version control the changes. Finally, use `git push` to upload the new version of your files to GitHub.\n\nYou might also want to use inline R code with `fontawesome::fa()` like at or and emojis like at . Check all previous examples I linked to, though these ones have some more advanced features:\n\n- + \n\n- + \n\n- + \n\n### 10. Share your website\n\n- Go to the Discussion Board in CoursePlus and write a short post with a link (URL) to your website (and URL to the corresponding GitHub repository) that you created.\n- As you read the introductions from other folks in the class, feel free to comment/reply using Discussion board.\n- Feel free to share your website with the world. If you use Twitter, use the `#postcards` hashtag and tag the author `@seankross` .\n\nIn class on Sept 12, I will show as many websites as I can from Courseplus!\n\n# R session information\n\n\n::: {.cell}\n\n```{.r .cell-code}\noptions(width = 120)\nsessioninfo::session_info()\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────\n setting value\n version R version 4.3.1 (2023-06-16)\n os macOS Ventura 13.5\n system aarch64, darwin20\n ui X11\n language (EN)\n collate en_US.UTF-8\n ctype en_US.UTF-8\n tz America/Mexico_City\n date 2023-08-28\n pandoc 3.1.5 @ /opt/homebrew/bin/ (via rmarkdown)\n\n─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────\n package * version date (UTC) lib source\n cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)\n colorout 1.2-2 2023-05-06 [1] Github (jalvesaq/colorout@79931fd)\n digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0)\n evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.0)\n fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)\n htmltools 0.5.6 2023-08-10 [1] CRAN (R 4.3.0)\n htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.0)\n jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.0)\n knitr 1.43 2023-05-25 [1] CRAN (R 4.3.0)\n rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0)\n rmarkdown 2.24 2023-08-14 [1] CRAN (R 4.3.1)\n rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)\n sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)\n xfun 0.40 2023-08-09 [1] CRAN (R 4.3.0)\n yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)\n\n [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library\n\n──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────\n```\n:::\n:::\n", "supporting": [], "filters": [ "rmarkdown/pagebreak.lua" diff --git a/projects/project-0/index.qmd b/projects/project-0/index.qmd index 4a5a07e..ecea42d 100644 --- a/projects/project-0/index.qmd +++ b/projects/project-0/index.qmd @@ -216,9 +216,6 @@ rstudioapi::restartSession() ## Editing the .Renviron is strongly discouraged now since it stores as ## simple text your GitHub personal access token (PAT) instead of the ## more secure approach provided by gitcreds. - -## Now run use_github() -usethis::use_github() ``` ### 5. Create Hub repo and link your RStudio project to it