In our house, we like puzzles and Wordle. My family noticed while playing the deployed version that there were some words that, while amusing to younger children, were not necessarily what we were expecting to be included. So, with Winston’s support, we decided to take a look at the word list and see if we could make some updates.
I’ve used GitHub and R, so I could start from there. I started with a few steps:
I was expecting to just modify a word list, basically by parsing and modifying the text file ‘wordlist.R’, putting in a pull request and waiting for it to be merged by Winston to see our changes. But, of course, we didn’t want to wait that long, so we decided to try deploying the Shiny app on our own instead.
First, we wanted to see if we could deploy it as it is without any modifications. I saw that Winston’s was deployed at shinyapps.io, so I too went to shinyapps.io to get set up.
Then, I went back to my RStudio IDE to try to deploy a Shiny app.
I thought I’d try the demo one first to make sure things were working, so I did File -> New File -> Shiny Web App:
That brought up a ‘New Shiny Web Application’ window. I named the it ‘shiny-demo’ and clicked ‘Create’.
That opened a window with the file ‘app.R’ that told me to click the button ‘Run App’, so I did!
And up opened a Shiny app on Old Faithful!
Great, so we had it working locally. We’re basically the coolest now; we did something interactive! Now, could we deploy it to shinyapps.io to share this exciting app with the world?
I went down to the console, first loaded the rsconnect package, and then deployed the app.
(If you forget to load the library, fear not, it won’t work, so you’ll be reminded that you need to do it).
Then 🎉! There it was at https://tracy-teal.shinyapps.io/shiny-demo/.
Empowered by deploying something, we wanted to go on to deploy the Shiny Wordle app. If we could, it would give us all the power to create whatever word lists we wanted!
I went back to my ‘shiny-wordle’ directory:
It opened locally! It was working!
Now to deploy.
That didn’t work. It said
Error in deployApp("app-final.R"):
"/Users/tracyteal/Documents/git/fork/shiny-wordle/app-final.R must be a directory, an R Markdown document, or an HTML document."
So, I renamed
app.R and ran:
(But I could have done
Then, it started and took awhile and then success!
There my app was at https://tracy-teal.shinyapps.io/shiny-wordle/.
Now to try editing the files.
We edited ‘wordlist.R’. The vector
words_common contains the set of words that are chosen to be the correct ones. So, rather than a whole list, we put in just a few words that we wanted to have as the answers.
If you want to add new words that aren’t necessarily actual words, like people’s names, you need to add them to both the
Then, we redeployed by running
We had to hit ‘y’ when it asked if we wanted to ‘Update application currently deployed’.
It ran and then, 🎉! We had our very own Wordle with our very own words!
A customized word list could be a very good gift for family or friends. ☺️
We went on to modify the whole word list, and put in that PR for Winston.
We learned a lot and are excited to try more. We were super excited to get an interactive app up and running so quickly.
So, with the Shiny app, we’ll keep working on the words, and maybe even a version with a different number of letters, as long as we can find a wordlist…
Welcome to the rstudio::glimpse() newsletter. Get a glimpse into our tools and how to use them.
We’d like to highlight and answer some of the great audience questions asked during the "MLOps with vetiver in Python and R" webinar.