Skip to content

Instantly share code, notes, and snippets.

View embruna's full-sized avatar

Emilio M. Bruna embruna

View GitHub Profile
@embruna
embruna / scraping_website_table.R
Created April 17, 2023 20:57
scraping a table from a website with rvest
library(rvest)
webpage <- read_html("https://www.computerworld.com/article/3109890/these-r-packages-import-sports-weather-stock-data-and-more.html")
tbls <- html_nodes(webpage, "table")
tbls_ls <- webpage %>%
html_nodes("table") %>%
.[1:1] %>%
html_table(fill = FALSE)
@embruna
embruna / text_analysis_example.R
Created April 17, 2023 20:04
sample text analysis and visualization, with download of texts from Project Gutenberg
# text mining resources ---------------------------------------------------
# * [Text Mining with R](https://www.tidytextmining.com/) by Julia Silge and David Robinson
# * [`gutenbergr`](https://cran.r-project.org/web/packages/gutenbergr/index.html): Download and Process Public Domain Works from [Project Gutenberg](https://www.gutenberg.org/). Tutorial can be found [here](https://docs.ropensci.org/gutenbergr/)
# install or load the libraries -------------------------------------------
library(tidyverse)
# organizing and analyzing the text files
@embruna
embruna / YAML_for_pdf.Rmd
Created April 17, 2023 18:57
Some TAML extensions for rendering Rmd to PDF
---
title: "title text"
date: "updated: `r Sys.Date()`" # using `r Sys.Date()` updates the exact date that you save as the update
header-includes:
- \usepackage[default]{sourcesanspro} # font choice: https://tug.org/FontCatalogue/sourcesanspro/
- \AtBeginDocument{\let\maketitle\relax} # this removes default title section
- \usepackage{fancyhdr} # modify header into left, center, right
- \pagestyle{fancy} # cues the use of fancy header
# to modify the Left Header [L]:
- \fancyhead[L]{LAS 6292 Spring `r format(Sys.time(), '%Y')`, EM Bruna}
@embruna
embruna / qualtrics_with_R
Created March 9, 2023 15:47
Qualtrics_with_R
# posts / tutorials --------------------------------------------------------
# https://www.adrianbruegger.com/post/import-qualtrics-csv-files/
# https://www3.nd.edu/~sberry5/qualtricsAPI.html
# https://blogs.uoregon.edu/rclub/2016/05/18/bringing-in-qualtrics-and-other-data/
# https://druedin.com/2019/12/01/getting-qualtrics-data-into-r/
# the 'qualtRics' package -------------------------------------------------
# ------------------------------------------------------------------------
## script name: wk_4_live_coding
## author: Emilio Bruna (embruna@ufl.edu)
## description: examples of using Tidyverse and BaseR for data clean-up
# introductory notes ------------------------------------------------------
# 1) Use pound symbol (#, a.k.a hashtag) to mark a line of your R script as a
# comment that R should ignore and not a command to be executed.
@embruna
embruna / github.R
Created November 30, 2022 21:36 — forked from z3tt/github.R
Configure GitHub for Rstudio
#### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
#### 2. Install git ##########################################################
## If you do not have git installed, please do so: