This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(purrr) | |
library(dplyr) | |
library(tidyr) | |
apikey="demo" | |
get_deal_properties = function(apikey="demo"){ | |
base_url = "https://api.hubapi.com" | |
properties_url = modify_url(base_url, | |
path ="/properties/v1/deals/properties/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load R packages for use | |
library("dplyr") | |
library("recipes") | |
library("rsample") | |
library("broom") | |
library("jsonlite") | |
library("sessioninfo") | |
# Sample data | |
sm_iris = initial_split(iris) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
iterations = 10, // Number of iterations | |
url = | |
"https://api.hubapi.com/deals/v1/deal/paged?" & "hapikey=demo" & "&includeAssociations=true" & "&limit=1" & "&properties=dealname" & "&propertiesWithHistory=true" | |
, | |
FnGetOnePage = | |
(url) as record => | |
let | |
Source = Json.Document(Web.Contents(url)), | |
data = try Source[deals] otherwise null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rtweet) #rtweet API creds should already be set up | |
library(stringi) | |
library(dplyr) | |
friends = get_friends(user="stephlocke") | |
followers = get_followers("stephlocke") | |
tweeps_id = distinct(bind_rows(friends, followers)) | |
tweeps_info = lookup_users(tweeps_id$user_id) | |
# A regex for a visit to Durham |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"userId": 1, | |
"id": 1, | |
"title": "Analytics", | |
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto" | |
}, | |
{ | |
"userId": 1, | |
"id": 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ----message=FALSE------------------------------------------------------- | |
library(tabulizer) | |
library(tidyverse) | |
library(zoo) | |
library(tidytext) | |
## ------------------------------------------------------------------------ | |
"http://www.pass.org/Portals/0/Governance%202017/2018%20Budget.pdf?ver=2017-10-26-171625-747×tamp=1509063392150" %>% | |
tabulizer::extract_text() -> | |
rawtxt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "sample" | |
output: | |
md_document: | |
variant: markdown_github | |
preserve_yaml: true | |
always_allow_html: yes | |
--- | |
```{r setup, include = FALSE, message = FALSE, warning = FALSE, error = FALSE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rvest) | |
"https://en.wikipedia.org/wiki/List_of_superhero_debuts" %>% | |
read_html() %>% | |
html_nodes(xpath = "//*[@id='mw-content-text']/div/table") %>% | |
map(html_table, fill = TRUE) %>% | |
map_df( ~ mutate(., `Year Debuted` = as.character(`Year Debuted`))) %>% | |
mutate(`Char_Team` = coalesce(`Character / Team / Series`, `Character / Team`)) %>% | |
select(Char_Team, Year_Debut = `Year Debuted`) %>% |