Crear proyecto RStudio
Crear un fichero Rmd llamado: “index.Rmd” pero con formato de salida “html”, o un fichero Quarto llamado: “index.qmd”.
Hacer “Knit” o “Render” sobre el fichero “index.Rmd”.
Activar el uso de git en el proyecto:
usethis::use_git_config(user.name = "Jane", user.email = "jane@example.org")
y luego: usethis::use_git().
Luego activar el uso de GitHub con
usethis::use_github().
ℹ Defaulting to "https" Git protocol.
! There are uncommitted changes and we're about to create and push to a new GitHub repo
Do you want to proceed anyway?
1: No way
2: For sure
3: Nope
Selection: 2
✔ Creating GitHub repository "calote/ConPaginaWeb".
✔ Setting remote "origin" to "https://github.com/calote/ConPaginaWeb.git".
✔ Pushing "master" branch to GitHub and setting "origin/master" as upstream branch.
✔ Opening URL <https://github.com/calote/ConPaginaWeb>.
Es decir, el repositorio creado en GitHub tiene la siguiente dirección: https://github.com/calote/ConPaginaWeb.
Hacer un Commit y luego un Push al repositorio en GitHub.
En GitHub hago lo siguiente:
En Settings del repositorio busco en su menú de la izquierda: “Pages”.
En Source dejo la opción: “Deploy from a branch”.
En Rama (o “Branch”) selecciono “master” (tal como se llama en RStudio), y en la carpeta dejo “/root” (podría seleccionar otra carpeta donde deberían estar mis ficheros html). Luego pulso sobre “Save”.
Durará unos instantes en construirse, pero la página web asociada a nuestro repositorio estará disponible en la siguiente dirección web: https://calote.github.io/ConPaginaWeb.
Se puede hacer clic en la rueda junto al apartado “About” (en la parte derecha del repositorio) y seleccionar: “Use your GitHub Pages website” y pulsar sobre “Save changes”.
Si escribimos la url: https://calote.github.io/ConPaginaWeb/index.Rmd, se descargaría el fichero “index.Rmd”. Siempre se podría ir al repositorio fuente https://github.com/calote/ConPaginaWeb y descargar el fichero “index.Rmd” y cualquiera que este disponible.
Más información sobre publicar en GitHub Pages: https://docs.github.com/es/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site
Puedo añadir ficheros Rmd o Quarto con salida html y los puedo enlazar desde mi fichero index.Rmd.
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.