library(rvest)
#> Loading required package: xml2
library(glue)
synonyms <- function(word) {
glue("https://www.thesaurus.com/browse/{word}") %>%
read_html() %>%
html_nodes(".synonyms-container span a[data-linkid]") %>%
html_text()
}
sample(synonyms("mutate"), 1L)
#> [1] "commute"
sample(synonyms("summarize"), 1L)
#> [1] "downsize"
sample(synonyms("filter"), 1L)
#> [1] "rarefy"
Created on 2018-11-09 by the reprex package (v0.2.1.9000)