{"id":341770,"date":"2023-04-30T06:00:00","date_gmt":"2023-04-30T12:00:00","guid":{"rendered":"https:\/\/www.business-science.io\/code-tools\/2023\/04\/30\/chatgpt-prompt-osmdata"},"modified":"2023-04-30T10:00:00","modified_gmt":"2023-04-30T16:00:00","slug":"how-to-r-code-faster-with-chatgpt","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2023\/04\/how-to-r-code-faster-with-chatgpt\/","title":{"rendered":"How to R code faster with ChatGPT"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"https:\/\/www.business-science.io\/code-tools\/2023\/04\/30\/chatgpt-prompt-osmdata.html\"> business-science.io<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n<p>Writing code is a <strong>slow process<\/strong> especially when you are first learning data science. <em>What if you could speed it up?<\/em> You can and this is how. In this free R-tip, I share a real case study where I made the working R code for my data analysis in <strong>under 30 seconds with ChatGPT<\/strong>.<\/p>\n\n<h3 id=\"table-of-contents\">Table of Contents<\/h3>\n\n<p>Today I share how to automate <code>R<\/code> coding with <code>ChatGPT<\/code>. Here\u2019s what you\u2019re learning today:<\/p>\n\n<ul>\n  <li><em>ChatGPT Prompts:<\/em> The mistake you\u2019ll make and how to get ChatGPT to write your code correctly.<\/li>\n  <li><em>2-Minute Case Study:<\/em> How I connecte to an API, Downloaded Data, and Visualized on a Map with <code>ChatGPT<\/code>.<\/li>\n  <li><strong>Bonus: Sneak Peek At My NEW Shiny App that extends this ChatGPT tutorial<\/strong><\/li>\n<\/ul>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/061_osmdata_thumb_2.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT Made This Shiny App\" data-recalc-dims=\"1\" \/><\/p>\n\n<hr \/>\n\n<h1 id=\"special-announcement-chatgpt-for-data-scientists-part-2-workshop\">Special Announcement: ChatGPT for Data Scientists Part 2 Workshop<\/h1>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/rtip_060_chatgpt.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT for Data Scientists\" data-recalc-dims=\"1\" \/><\/p>\n\n<p><strong>What:<\/strong> ChatGPT for Data Scientists Part 2<\/p>\n\n<p><strong>When:<\/strong> Wednesday May 3rd, 2pm EST<\/p>\n\n<p><strong>How It Will Help You:<\/strong> Whether you are new to data science or are an expert, ChatGPT is changing the game. There\u2019s a ton of hype. But how can ChatGPT actually help you become a better data scientist and help you stand out in your career? I\u2019ll show you inside <a href=\"https:\/\/us02web.zoom.us\/webinar\/register\/4016828627927\/WN_hhbgsplKR_u4u7ZiJQvVSA\" rel=\"nofollow\" target=\"_blank\">my free chatgpt for data scientists workshop<\/a>.<\/p>\n\n<p><strong>Why Part 2?<\/strong> In part 1, I focused on the mistakes I was making using chatgpt (super useful). In part 2, I want to share how I\u2019m fixing the mistakes (<strong>even more useful<\/strong>).<\/p>\n\n<p><strong>Price:<\/strong> Does <strong>Free<\/strong> sound good?<\/p>\n\n<p><strong>How To Join:<\/strong> <a href=\"https:\/\/us02web.zoom.us\/webinar\/register\/4016828627927\/WN_hhbgsplKR_u4u7ZiJQvVSA\" rel=\"nofollow\" target=\"_blank\"><strong>Register Here<\/strong><\/a>.<\/p>\n\n<hr \/>\n\n<h1 id=\"r-tips-weekly\">R-Tips Weekly<\/h1>\n\n<p>This article is part of R-Tips Weekly, a <a href=\"https:\/\/learn.business-science.io\/r-tips-newsletter\" rel=\"nofollow\" target=\"_blank\">weekly video tutorial<\/a> that shows you step-by-step how to do common R coding tasks. Pretty cool, right?<\/p>\n\n<p>Here are the links to get set up. \ud83d\udc47<\/p>\n\n<ul> <li><a href=\"https:\/\/learn.business-science.io\/r-tips-newsletter\" rel=\"nofollow\" target=\"_blank\">Get the Code<\/a><\/li> <li><a href=\"https:\/\/youtu.be\/0u1y5RU_to4\" rel=\"nofollow\" target=\"_blank\">YouTube Tutorial<\/a><\/li> <\/ul>\n\n<h1 id=\"this-tutorial-is-available-in-video\">This Tutorial is Available in Video<\/h1>\n\n<p>I have a companion video tutorial that walks you through how to use <code>chatGPT<\/code> for this analysis. And, I\u2019m finding that a lot of my students prefer the dialogue that goes along with coding. So check out this video to see me running the code in this tutorial. \ud83d\udc47<\/p>\n\n<iframe width=\"450\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/0u1y5RU_to4\" title=\"YouTube video player\" frameborder=\"1\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"><\/iframe>\n\n<h1 id=\"chatgpt-and-the-importance-of-your-prompts\">ChatGPT: And the Importance of Your Prompts<\/h1>\n\n<p>In my last R-Tip, I showed you how ChatGPT I made a <a href=\"https:\/\/www.business-science.io\/code-tools\/2023\/04\/02\/chatgpt-shiny-app.html\" rel=\"nofollow\" target=\"_blank\">full R Shiny App in under 10-minutes<\/a>. That was insane!<\/p>\n\n<h2 id=\"but-after-that-r-tip-i-felt-a-bit-of-a-let-down\">But, after that R-tip, I felt a bit of a let down.<\/h2>\n\n<p>I began to try more and more complex stuff.<\/p>\n\n<ul>\n  <li>I failed building high-end Shiny apps.<\/li>\n  <li>I failed doing machine learning and integrating it into apps.<\/li>\n  <li>And I got so frustrated that I even made a <a href=\"https:\/\/university.business-science.io\/p\/learning-labs-pro\" rel=\"nofollow\" target=\"_blank\">learning lab 82: ChatGPT for Data Scientists<\/a>, where I showed every mistake I made in building a Production Shiny App (including the prompts, the 11 things I needed to fix in a live workshop, plus my debugging process).<\/li>\n<\/ul>\n\n<p>But, now I\u2019m 12 weeks into <code>chatGPT<\/code> and I\u2019ve realized 1 thing\u2026<\/p>\n\n<h2 id=\"how-important-chatgpt-prompting-is\">How important <code>chatgpt<\/code> prompting is.<\/h2>\n\n<p>Take a look at this prompt. It\u2019s just 2 sentences:<\/p>\n\n<p><img src=\"https:\/\/i0.wp.com\/www.business-science.io\/assets\/061_chatgpt_prompt.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT Prompt\" data-recalc-dims=\"1\" \/><\/p>\n\n<p>Looks fairly straightforward, but I need to show you why this prompt works (and what mistakes I was making in the last 11 weeks of using ChatGPT).<\/p>\n\n<h1 id=\"chatgpt-prompt-guide-for-r-users\">Chatgpt Prompt Guide (for R users)<\/h1>\n\n<p>The mistake I was making was <strong>not being specific<\/strong> enough in directing <code>chatgpt<\/code> what R code I want it to write for me.<\/p>\n\n<p>If you look at what I\u2019m doing now\u2026<\/p>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/061_chatgpt_prompt_guide.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT Prompt Guide for R Users\" data-recalc-dims=\"1\" \/><\/p>\n\n<p>\u2026I specify:<\/p>\n\n<ul>\n  <li><strong>Which R Libraries<\/strong> <\u2013 always do this<\/li>\n  <li>For this case study I want to know locations of all business types in a certain area:\n    <ul>\n      <li>Which Business Types<\/li>\n      <li>Which Geographic Location<\/li>\n    <\/ul>\n  <\/li>\n<\/ul>\n\n<p>And it generates the code for me:<\/p>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/061_chatgpt_code_osmdata_example.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT Code OSMdata Example\" data-recalc-dims=\"1\" \/><\/p>\n\n<p class=\"text-center date\"> <a href=\"https:\/\/learn.business-science.io\/r-tips-newsletter\" rel=\"nofollow\" target=\"_blank\"><strong>Steal my code (it&#8217;s legal).<\/strong><\/a> <\/p>\n\n<h1 id=\"does-the-code-work\">Does the code work?<\/h1>\n\n<p>A big problem that data scientists are facing is that <code>chatgpt<\/code> code isn\u2019t working out of the box.<\/p>\n\n<p>So let\u2019s test the code. I ran it\u2026.<\/p>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/061_chatgpt_does_it_work.jpg?w=578&#038;ssl=1\" alt=\"Does the ChatGPT code work?\" data-recalc-dims=\"1\" \/><\/p>\n\n<p class=\"text-center date\"> <a href=\"https:\/\/learn.business-science.io\/r-tips-newsletter\" rel=\"nofollow\" target=\"_blank\"><strong>Steal my code (it&#8217;s legal).<\/strong><\/a> <\/p>\n\n<p>\u2026 And, it runs!<\/p>\n\n<p>But, here\u2019s the problem\u2026<\/p>\n\n<h1 id=\"will-your-chatgpt-code-work\">Will your ChatGPT code work?<\/h1>\n\n<p>The answer depends on how well you know the R ecosystem and can specify exactly what you want.<\/p>\n\n<p>Question: Are you struggling with any of these tasks?<\/p>\n\n<ul>\n  <li><strong>Writing R code<\/strong><\/li>\n  <li>Doing business analysis<\/li>\n  <li><strong>Building solutions that company\u2019s want<\/strong><\/li>\n  <li>Making a project portfolio for yourself<\/li>\n  <li><strong>Making solutions for your company<\/strong><\/li>\n<\/ul>\n\n<p>Then I have a free bonus:<\/p>\n\n<h1 id=\"free-bonus-attend-my-free-workshop-chatgpt-for-data-scientists-part-2\">FREE BONUS: Attend My Free Workshop, ChatGPT for Data Scientists Part 2<\/h1>\n\n<p><a href=\"https:\/\/us02web.zoom.us\/webinar\/register\/4016828627927\/WN_hhbgsplKR_u4u7ZiJQvVSA\" rel=\"nofollow\" target=\"_blank\">Inside the workshop<\/a> I\u2019ll share how I built this Shiny App with <code>ChatGPT<\/code> (extends this data analysis to an <em>insane<\/em> production app):<\/p>\n\n<p><img src=\"https:\/\/i1.wp.com\/www.business-science.io\/assets\/chatgpt_pharmacy_finder.jpg?w=578&#038;ssl=1\" alt=\"ChatGPT Shiny App\" data-recalc-dims=\"1\" \/><\/p>\n\n<p><strong>What:<\/strong> ChatGPT for Data Scientists Part 2<\/p>\n\n<p><strong>When:<\/strong> Wednesday May 3rd, 2pm EST<\/p>\n\n<p><strong>How It Will Help You:<\/strong> Whether you are new to data science or are an expert, ChatGPT is changing the game. There\u2019s a ton of hype. But how can ChatGPT actually help you become a better data scientist and help you stand out in your career? I\u2019ll show you inside <a href=\"https:\/\/us02web.zoom.us\/webinar\/register\/4016828627927\/WN_hhbgsplKR_u4u7ZiJQvVSA\" rel=\"nofollow\" target=\"_blank\">my free chatgpt for data scientists workshop<\/a>.<\/p>\n\n<p><strong>Why Part 2?<\/strong> In part 1, I focused on the mistakes I was making using chatgpt (super useful). In part 2, I want to share how I\u2019m fixing the mistakes (<strong>even more useful<\/strong>).<\/p>\n\n<p><strong>Price:<\/strong> Does <strong>Free<\/strong> sound good?<\/p>\n\n<p><strong>How To Join:<\/strong> <a href=\"https:\/\/us02web.zoom.us\/webinar\/register\/4016828627927\/WN_hhbgsplKR_u4u7ZiJQvVSA\" rel=\"nofollow\" target=\"_blank\"><strong>Register Here<\/strong><\/a>.<\/p>\n\n<p>See you there!<\/p>\n\n<p>-Matt Dancho<\/p>\n\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"https:\/\/www.business-science.io\/code-tools\/2023\/04\/30\/chatgpt-prompt-osmdata.html\"> business-science.io<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div style = \"width:60%; display: inline-block; float:left; \"> Writing code is a slow process especially when you are first learning data science. What if you could speed it up? You can and this is how. In this free R-tip, I share a real case study where I made the working R code for my data analysis in under 30 &#8230;<\/div>\n<div style = \"width: 40%; display: inline-block; float:right;\"><\/div>\n<div style=\"clear: both;\"><\/div>\n","protected":false},"author":2198,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/341770"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/2198"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=341770"}],"version-history":[{"count":8,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/341770\/revisions"}],"predecessor-version":[{"id":344776,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/341770\/revisions\/344776"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=341770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=341770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=341770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}