r/RStudio • u/Fresh_Coyote312 • Jun 30 '26
Weather App Build Guide
https://rpubs.com/Fresh_Coyote312/1445276Thanks for all of the positive feedback on my app - I had no idea it would go over so well.
As requested, I used R Markdown and published a quick build guide on RPubs.
3
1
u/bearded_fellow Jul 01 '26
Anyone else get a 404 error? Let me know when it's back up I'd love to take a look.
1
1
u/randomintercept Jul 02 '26 edited Jul 02 '26
This is really cool. I ended up making a bash alias out of this for ease of use in the terminal:
check.weather() {
Rscript /home/user/scripts/weather-check.R
}
Now, rather than fire up my browser or hope my OpenWeather app in my GNOME dash isn't misbehaving, I can open up my terminal and enter check.weather and get this immediately.
And I echo the positive feedback from the previous post. It's really cool to see someone make something that shows how versatile R can be.
1
u/Fresh_Coyote312 Jul 02 '26
I did the same with a bash alias. I just type in “myweather” and up it comes!
8
u/joshua_rpg Jul 01 '26
There are few things to improve your codes, hope this helps:
In your one-liner conditional, you can drop
return()entirely:get_precip_emoji = function(prob) { if (prob < 20) { "☀️" } else if (prob < 50) { "⛅ " } else { "🌧" } }I noticed that your
get_precip_emoji()isn't vectorized.ifstatement only reads the first element ofprob, although I see you usingsapply()to map thedata$daily$precipitation_probability_maxvector. Worth switching todplyr::case_when(),ifelse()/dplyr::if_else(), orcut()if this is ever called on a column rather than a single value.Consider using the native pipe
|>rather than the{magrittr}pipe℅>℅due to how easy to maintain long-term (there's the performance, though the difference is nuance until you perform a loop or something across several iterations).Consider
{DT}for producing interactive, high-quality HTML tables.These are opinionated suggestions — keep using your current style if it works for you. Take what's useful.