Skip to content

Commit

Permalink
change eval status to TRUE of some chunks and update some info
Browse files Browse the repository at this point in the history
  • Loading branch information
Melii99 committed Jun 8, 2024
1 parent f4bd9c6 commit 67493b5
Showing 1 changed file with 23 additions and 28 deletions.
51 changes: 23 additions & 28 deletions 14_postcards.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The base directory it takes will be the one you are in when you load the here pa

In this case, the package is already installed so we just need to load it.

```{r, eval=FALSE, warning=FALSE, message=FALSE}
```{r, load_here}
## Install the package manually
# install.packages("here")
Expand All @@ -34,7 +34,7 @@ library("here")

Sometimes there might be an error, as it might clash with other packages (like plyr). To avoid this, we can use here::here (which basically clarifies that the requested function is from the here package).

```{r, here::here, eval=FALSE, warning=FALSE, message=FALSE}
```{r, here::here}
here::here()
```

Expand All @@ -44,7 +44,7 @@ Some usefull commands are "getwd" and "setwd", which deal with the working direc

- setwd() allows changing the current working directory.

```{r, check_paths, eval=FALSE, warning=FALSE, message=FALSE}
```{r, check_paths, eval=FALSE}
getwd() # returns the current path
setwd("desired/directory") # changes to the specified path
```
Expand All @@ -56,7 +56,7 @@ setwd("desired/directory") # changes to the specified path
> avoids issues with hard-coded paths and ensures your scripts work regardless of the specific setup of your working environment.

```{r, bestpractice, eval=FALSE, warning=FALSE, message=FALSE}
```{r, bestpractice, eval=FALSE}
## Instead of "C:/Users/user/Desktop/data/myfile.csv"
## Use here to construct file paths
Expand All @@ -67,7 +67,7 @@ data <- read.csv(file_path)

Other examples of how "here" could be used:

```{r, here_examples, eval=FALSE, warning=FALSE, message=FALSE}
```{r, here_examples}
## Example: save data to a file and load it
a <- 1
c <- 23
Expand Down Expand Up @@ -101,7 +101,7 @@ The usethis package simplifies many common setup tasks and workflows in R. It he

In this case, the package is already installed so we just need to load it.

```{r, load_usethis, eval=FALSE, warning=FALSE, message=FALSE}
```{r, load_usethis}
## Install the package manually
# install.packages("usethis")
Expand All @@ -113,7 +113,7 @@ Usage:

All use_* functions operate on the current directory.

```{r, use_*, eval=FALSE, warning=FALSE, message=FALSE}
```{r, use_*}
## usethis::use_*()
usethis::use_r()
usethis::use_git()
Expand All @@ -123,11 +123,9 @@ usethis::use_readme_md()
✔ indicates that usethis has setup everything for you.
● indicates that you'll need to do some work yourself.

```{r, usethis_example, eval=FALSE, warning=FALSE, message=FALSE}
```{r, usethis_example}
## For example, create a README file
usethis::use_readme_md()
#> ✔ Writing 'README.md'
#> ● Edit 'README.md'
```

More functions in usethis:
Expand Down Expand Up @@ -158,11 +156,10 @@ We also need to install Git on our computers as the "gitcreds" package requires

After installing Git, restart RStudio to allow it to annex.

***Hay que agregarlos a los paquetes a instalar ??? ***
In this case, the packages are already installed so we just need to load them.

```{r, install_gitreq, eval=FALSE, warning=FALSE, message=FALSE}
## Packages we will need
install.packages(c("gitcreds", "gert", "gh"))
# install.packages(c("gitcreds", "gert", "gh"))
## Load them separately
library("gitcreds")
Expand All @@ -176,14 +173,14 @@ To connect our RStudio repository with GitHub, we request a token, which allows

You can request the token using R (choose a meaningful name).

```{r, token, eval=FALSE, warning=FALSE, message=FALSE}
```{r, token, eval=FALSE}
## Initiate connection with GitHub
usethis::create_github_token() # redirects to GitHub where you'll choose a specific name for the token
```

Copy the token to enter it later with gitcreds_set()

```{r, gitcreds, eval=FALSE, warning=FALSE, message=FALSE}
```{r, gitcreds, eval=FALSE}
gitcreds::gitcreds_set() # here you place the token (NOT your GitHub password!!!)
```

Expand All @@ -198,7 +195,7 @@ Another way to request the token is by going to [GitHub Tokens](https://github.c

The next step is to configure our GitHub user in the .gitconfig file:

```{r, git_config, eval=FALSE, warning=FALSE, message=FALSE}
```{r, git_config, eval=FALSE}
## Configure GitHub user
usethis::edit_git_config() # opens the .gitconfig file
Expand All @@ -214,7 +211,7 @@ usethis::edit_git_config() # opens the .gitconfig file

Now let's initialize the repository in Git (locally on your computer) and then request to connect it with GitHub servers. (Git is the software while GitHub is the web platform (based on Git) that allows collaboration).

```{r, git_repo, eval=FALSE, warning=FALSE, message=FALSE}
```{r, git_repo, eval=FALSE}
## Initialize the Git repository
usethis::use_git()
Expand All @@ -227,7 +224,7 @@ usethis::use_github()

Useful command to check configuration:

```{r, gh_whoami, eval=FALSE, warning=FALSE, message=FALSE}
```{r, gh_whoami, eval=FALSE}
gh::gh_whoami()
```

Expand All @@ -242,7 +239,7 @@ Some useful commands for this are:
- git_log
- git_push

```{r, git_commands, eval=FALSE, warning=FALSE, message=FALSE}
```{r, git_commands, eval=FALSE}
## Write a new file, using here::here to specify the path
writeLines("hello", here::here("R", "test-here.R"))
Expand Down Expand Up @@ -330,7 +327,7 @@ To render the site, use the rmarkdown::render_site() function, which converts al

Common elements, such as shared HTML files and CSS for styling, ensure consistency and avoid redundancy. A well-configured navigation bar enhances user experience by providing easy access to different sections.

```{r, render_site, eval=FALSE, warning=FALSE, message=FALSE}
```{r, render_site, eval=FALSE}
rmarkdown::render_site()
```

Expand Down Expand Up @@ -391,11 +388,9 @@ Some examples:

### Installation

In this case, the package is already installed
In this case, the package is already installed.

Agregar postcards a los paquetes !!!!

```{r, install_postcards, eval=FALSE, warning=FALSE, message=FALSE}
```{r, install_postcards}
## You can install Postcards with the following command:
# install.packages("postcards")
Expand Down Expand Up @@ -457,7 +452,7 @@ Select "Create Project" after choosing a name for the folder that will contain y
- An R Markdown document with your site's content
- A sample photo you should replace (with your own)

```{r, postcards_project, eval=FALSE, warning=FALSE, message=FALSE}
```{r, postcards_project, eval=FALSE}
## Create a new project
usethis::create_project("Your_Username.github.io")
```
Expand All @@ -466,15 +461,15 @@ usethis::create_project("Your_Username.github.io")

To save changes, you need to set up Git and GitHub

```{r, setup_gitpcds, eval=FALSE, warning=FALSE, message=FALSE}
```{r, setup_gitpcds, eval=FALSE}
## Set up Git and GitHub
usethis::use_git() # Restart the session
usethis::use_github()
```

### Choose a Template

```{r, choose_template, eval=FALSE, warning=FALSE, message=FALSE}
```{r, choose_template}
## Choose only one template (the one you like the most)
postcards::create_postcard(template = "jolla")
postcards::create_postcard(template = "jolla-blue")
Expand Down Expand Up @@ -503,7 +498,7 @@ To compile the self-contained HTML file for the site:
In RStudio, you can use the "Knit" button
or directly:

```{r, deploy_postcards, eval=FALSE, warning=FALSE, message=FALSE}
```{r, deploy_postcards, eval=FALSE}
## Deploy the GitHub page
rmarkdown::render("index.Rmd")
```
Expand Down

0 comments on commit 67493b5

Please sign in to comment.