<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Helena Belloff on Medium]]></title>
        <description><![CDATA[Stories by Helena Belloff on Medium]]></description>
        <link>https://medium.com/@helena.belloff?source=rss-9b79014c3c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*mx3nXfIMrvqvGSr-</url>
            <title>Stories by Helena Belloff on Medium</title>
            <link>https://medium.com/@helena.belloff?source=rss-9b79014c3c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:49:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@helena.belloff/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Very Informal Guide to R Programming]]></title>
            <link>https://blog.devgenius.io/a-very-informal-guide-to-r-programming-988c77e8f3fe?source=rss-9b79014c3c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/988c77e8f3fe</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[Helena Belloff]]></dc:creator>
            <pubDate>Wed, 05 Mar 2025 19:58:07 GMT</pubDate>
            <atom:updated>2025-03-27T15:54:14.429Z</atom:updated>
            <content:encoded><![CDATA[<h4>Getting Started with R: Installation, Usage, and Pro Tips I Wish I Knew as a Beginner</h4><h3>What is R?</h3><blockquote><strong>✅ R is an open-source statistical computing language.</strong></blockquote><p>I was once asked in an interview what “R” stood for. I had been using R for years, and I had never pondered the question before. Caught off guard, I fumbled through an explanation about how R is an open-source statistical computing language and so it must have something to do with the statistical correlation coefficient commonly abbreviated as R — a valiant effort on my part, but the incorrect answer (I still got the job).</p><p>R was created by two statisticians, Ross Ihaka and Robert Gentleman, at the University of Auckland in 1993. It was named “R” for the first names of these two authors and as a play on the S programming language, which was developed by members of Bell Labs (mainly John Chambers) in the 1970s. For ease of understanding, R is just a more current implementation of S (although R is also inspired by Scheme, another programming language created at MIT in the 1970s).</p><p>Today, R is maintained by members of the R Development Core Team (of which John Chambers is a member), who continue to provide support for the R Project and interact with the R community. R is used for statistical programming and visualization and can be installed for <em>free</em> on most machines.</p><p><strong>Note</strong>: Not all coding languages are “open-source”. An example is Matlab, which is a coding language that requires a license to be able to use it. There are pros and cons to both types of coding languages, but it really depends on your use case.</p><blockquote><strong>✅ RStudio is an IDE (Integrated Development Environment) for R.</strong></blockquote><p>Think Eclipse for Java or PyCharm for Python, if you’re familiar. It includes a dashboard with a console, debugger, global environment, history viewer, etc. It augments the coding experience and is highly recommended. If you don’t use RStudio, your R coding experience will be frustrating.</p><blockquote>When I first started coding, I actually refused to use RStudio because the first language I ever learned was Java, and I hated coding in Eclipse, a popular Java IDE (it’s been about a decade since I’ve used Eclipse and when I tried to launch the application after all this time I got the <a href="https://en.wikipedia.org/wiki/Spinning_pinwheel">spinning wheel of death</a> and had to restart my computer. It’s obviously a sign). I assumed the R-equivalent would be just as frustrating so I coded in the standard R console for years… but don’t make this mistake. RStudio is NECESSARY.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0-dzp4RTRXnXV6VeLS9dQ.png" /><figcaption>The classic R Console. Ah, the light switch icon in the top right corner — a true design masterpiece. You’d think, “Oh, this must switch between light mode and dark mode for late-night coding.” But no, it’s actually a cleverly disguised self-destruct button to “turn off” R entirely. Because nothing improves productivity like accidentally nuking your session while fumbling for a theme change.</figcaption></figure><h3>💾 Installing R and RStudio</h3><p>R should always be downloaded to your machine before RStudio. The latest version of R can be found here: <a href="https://www.r-project.org/">The R Project for Statistical Computing</a>.</p><p><strong>Note</strong>: The different versions of R have fun names — Version 4.4.2 is called “Pile of Leaves” - they are mostly references to the Peanuts comic strip and various Charlie Brown films because apparently <a href="https://www.youtube.com/watch?v=z1vTSdRolgI">everyone in statistics is a P-nut</a> 🥜.</p><p>1️⃣ In order to download R, you must choose your preferred <a href="https://cran.r-project.org/mirrors.html">CRAN mirror</a>.</p><p>CRAN stands for Comprehensive R Archive Network. This network is a collection of sites, which all store identical information (hence, ‘mirror’) about R packages and are updated daily. When you go to the CRAN mirror page, you will see this network spans sites across the world. You should click on the URL closest to your geographic location and select the download that is appropriate for your machine (i.e., Windows or Mac). Selecting a CRAN mirror closest to your location will allow for faster and more efficient package downloads (we’ll talk about packages later).</p><p>2️⃣ Once R is installed properly, it is highly recommended you install RStudio as it is much more user-friendly. RStudio can be downloaded here: <a href="https://posit.co/download/rstudio-desktop/">Posit</a>.</p><p>Download the free, open-source desktop version for your personal machine.</p><h3>🥊 Getting Started</h3><p>Now that you have successfully installed R and RStudio, let’s get familiar.</p><p>We will be using RStudio, which will look something like this when you first open the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9OAS1L5Edi7SVOn8t4C-g.png" /><figcaption>The IDE has 4 main panes. Only three panes are pictured here. Keep reading to see how to reveal the fourth pane.</figcaption></figure><h4>IDE Panes</h4><ol><li><strong>Console, Terminal, Background Jobs</strong></li></ol><figure><img alt="The bottom console on the left is where you can type and run code." src="https://cdn-images-1.medium.com/max/1024/1*rLVmHPg3Zl0bOjVE_ZspcQ.png" /><figcaption>The console pane is where you run code.</figcaption></figure><p>Your R console will always start with the symbol “&gt;”, which just indicates a new line where you can type code. If you type 2 + 2 and hit enter, you’ll see the output line doesn’t have this symbol.</p><p><strong>2. Files, Plots, Packages, Help, Viewer, Presentation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tw-xjwp0Ard8eybXfOqSEA.png" /><figcaption>The bottom right pane is where you can see files from your computer, the plots you generate, the packages you’ve installed, and information about R packages and functions.</figcaption></figure><p>Spend some time clicking through the different tabs in this pane. There’s a lot of functionality here, but it’s all self-explanatory.</p><p><strong>3. Environment, History, Connections</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcE42hgAY15xV5VDMCPrbg.png" /><figcaption>The top right pane of the IDE is your global environment, which is where your data frames, variables, and functions will appear. You can also view your coding history and see your connections (for example, you can connect RStudio to your data warehouse and query data directly from the IDE).</figcaption></figure><p>Type the following in the console and hit enter.</p><pre>x &lt;- &quot;Hello World!&quot;</pre><p>You have just created a variable called “x” that contains the string “Hello World!”. x is now visible in your global environment.</p><p>If you want to remove x from your environment, simply type:</p><pre>rm(x)</pre><p>If you ever want to clear everything out of your global environment at once, you can use:</p><pre>rm(list=ls())</pre><p>You can also switch your view to see the variables and functions contained in the R packages you have installed (but more on packages later).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsQG0PRBdURXNMECiSWiSg.png" /><figcaption>Click on the dropdown to the right of “R” in the top left of this pane. If you click on “acf” in the “package:stats”, the acf function will output in the console.</figcaption></figure><p><strong>4. Source</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aN6BiIEJzdtnoLl6OyuArA.png" /><figcaption>Click on the icon circled in red to reveal the Source pane.</figcaption></figure><p>The Source pane is where you can write and save R scripts. An R “script” is like a text file (.txt) or a word document (.docx) in that it’s where you write and save your work for later use. The resultant file will be a .R file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5X4wdaSMdaMLm-5botdU5A.png" /><figcaption>Here, we created an R script called “Hello_World.R” where we left a comment (“#” symbol) and defined our variable, x, as “Hello World!”. You can save and name this script like you would any other document (command + s or by hitting the save icon).</figcaption></figure><blockquote><strong>Pro Tip</strong>: Highlight the code in your R Script and then hit Command + Enter. This will execute the highlighted portion in your console.</blockquote><p>You can customize the pane layout in RStudio and even change the code and background colors. Simply click on “Tools” → “Global Options”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xqpmbrq8MR34adpWLscLqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wugY6WI09fAhGK5k_kV6cA.png" /><figcaption>The Options panel allows you to customize your IDE. I typically opt for a darker background because it’s easier on my eyes.</figcaption></figure><p>Customize your IDE appearance and then click ‘Apply’.</p><h3>💻 Start coding</h3><p>As already discussed:</p><blockquote><em>“</em><strong><em>&gt;</em></strong><em>”</em><strong><em> </em></strong>denotes a new line to write code</blockquote><blockquote>“<strong>#</strong>” is used to insert comments in your code</blockquote><p>Your R console will always start with “&gt;”, and if you don’t type anything and keep hitting enter, you’ll see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6J0s58CNONGd2UPG_YIbtQ.png" /></figure><p>Now, let’s add a comment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mh7MGv6Ez-EcnAKsIQiDvQ.png" /><figcaption>It’s good practice to add comments to your code because it will help you stay organized and allow others to read through your code and understand the requirements and functions.</figcaption></figure><p>If you hit enter in your console and you see a “+,” that means you either made a mistake closing parentheses, or you messed something else up in your syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9oJNyCAXEcUUdcXGAXHNEw.png" /><figcaption>R thinks that you’re not done typing so if you keep hitting enter, you’ll keep seeing the “+”. To stop this, simply press the esc button on your keyboard and retype your code correctly or fix your syntax (in this case, we close the parentheses and hit enter).</figcaption></figure><blockquote><strong>Pro Tip: </strong>Use the up arrow on your keyboard to automatically retype a line of code you typed previously (just type some code, hit enter, then press the up arrow to see what I’m talking about). You can also hit the up arrow multiple times in a row to iterate through your code history in the console.</blockquote><p>Also, R will typically spit out indices with its output, which — in the case above — is “1” (denoted by [1]). However, the index of a number or character will only be visible at the start of each line in the output. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFE6acCy5x4EjCD4HVqrKw.png" /><figcaption>A vector of 18 integers is printed out. The first integer on the first line has “[1]” in front of it because it’s the 1st number in this vector. The first integer on the second line has “[8]” in front of it because it’s the 8th number in this vector. The number to the right of it is the 9th integer, but “[9]” is not listed because it’s not at the beginning of a new line.</figcaption></figure><p><strong>⚠️ A NOTE TO ALL ENGINEERS</strong>: R indices start at 1 and not 0 like in other languages. I know… saved you from learning that one the hard way ;)</p><blockquote><strong>Pro Tip: </strong>If you’re ever stuck, you can type “??help” to pull up the help menu (or click on the help tab in the bottom right pane).</blockquote><p>You’ll be able to search in the window that pops up for whatever you’re trying to do. However, when you use the search tool in R, use one-word searches only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*koa4tLdCxTkjGcUndKPhWg.png" /><figcaption>If you type something like “how to plot” your search will come up empty. Instead, we type “plot” to pull up the documentation for R’s native plotting function.</figcaption></figure><p>If your search is more than one word like “str replace” (for string replacements, we’ll cover this later), you should type “str_replace” (underscores are your new best friend).</p><h3>📦 Packages</h3><p>The core R coding language is augmented by extension packages, which contain reusable code and documentation. Packages can be created by anyone and submitted to CRAN (or Bioconductor, which is another repository of packages related to computational biology or bioinformatics, or you can simply upload your package to Github if you don’t want to go through a lengthy approval process). If you want your R package to be widely consumed, you’ll have to submit it to the CRAN administrative team for review: <a href="https://kbroman.org/pkg_primer/pages/cran.html">Getting your R Package on CRAN</a>. This is a team of engineers who make sure every package in R’s main repository is properly maintained and tested.</p><p>You can install a package by typing:</p><pre>install.packages(&lt;&quot;package-to-install&quot;&gt;)</pre><p>Once the package is installed, you then need to load your package:</p><pre>library(&lt;package-name&gt;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOPkpQ8SGonEuMS0r-MPpg.png" /><figcaption>When installing packages, you’ll see a bunch of warning messages and trys followed by (hopefully) a success message.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOtivN8DY6fjZ_ZVSuaWDw.png" /><figcaption>Once the package is installed, you never have to re-install it. To use it, you only have to load it once during each R session.</figcaption></figure><p>To see which packages are installed in your environment, navigate to the “Packages” tab in the bottom right pane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L5kc-byX6ibcglH3CvGUgQ.png" /><figcaption>If you see a checkmark next to a package, that means it’s already loaded in your current session. You can also load a package in a session by manually checking the box next to the package in this pane instead of typing library(&lt;package-name&gt;).</figcaption></figure><p>You’ll find that R comes with a basic set of packages already installed. However, some very useful packages to install and utilize are listed below:</p><blockquote><strong><em>dplyr</em></strong><em> — data frame manipulation and wrangling</em></blockquote><blockquote><strong><em>stringr</em></strong><em> — string manipulation and wrangling</em></blockquote><blockquote><strong><em>tidyr or tidyverse</em></strong><em> — collection of useful data science packages (if you install tidyverse, it will automatically install tidyr, dplyr, stringr, ggplot2, purrr, readr, tibble, and forcats — I recommend doing this)</em></blockquote><blockquote><strong><em>lubridate</em></strong><em> — manipulation and wrangling of dates and datetimes</em></blockquote><blockquote><strong><em>ggplot2</em></strong><em> — data visualization and plotting</em></blockquote><blockquote><strong><em>plotly </em></strong><em>— interactive data visualization and plotting (can use with ggplot2)</em></blockquote><blockquote><strong><em>readxl </em></strong><em>— to read in and manipulate excel spreadsheets</em></blockquote><blockquote><strong><em>writexl </em></strong><em>— to export dataframes as excel spreadsheets</em></blockquote><blockquote><strong><em>readr </em></strong><em>— to read in and manipulate csvs or text files</em></blockquote><blockquote><strong><em>haven</em></strong><em> — to read in and manipulate SAS, Stata, or SPSS files</em></blockquote><blockquote><strong><em>Pro Tip</em></strong><em>: If you want to see what a specific package does (all its associated functions, etc.) type ??the-package-name or type the name of your package in the Help tab.</em></blockquote><p>If you’re looking for more documentation, you can find comprehensive package manuals on the R project’s website (see example <a href="https://cran.r-project.org/web/packages/dplyr/dplyr.pdf">dplyr manual</a>).</p><blockquote>You can also find various “cheatsheets” for common R packages <a href="https://github.com/rstudio/cheatsheets/blob/main/README.md">here</a>.</blockquote><p>If you want a random dataset to practice on, install the package called ‘datasets’. It contains a bunch of real-world, open-source datasets.</p><p>After you install it, type:</p><pre>library(help = &quot;datasets&quot;)</pre><p>Some examples you’ll find in this package include:</p><blockquote><em>Indometh — Pharmacokinetics of Indomethacin</em></blockquote><blockquote><em>InsectSprays — Effectiveness of Insect Sprays</em></blockquote><blockquote><em>JohnsonJohnson — Quarterly Earnings per Johnson &amp; Johnson Share</em></blockquote><blockquote><em>beavers — Body Temperature Series of Two Beavers</em></blockquote><blockquote><em>Orange — Growth of Orange Trees</em></blockquote><h3>📂 Projects and Working Directories</h3><p>A “working directory” is the path on your computer that R is using to read and write files. You can print your current working directory by typing:</p><pre>getwd()</pre><p>You can also manually set your working directory. For example, if I create a folder on my Desktop called “R_Practice” and want to store all my R scripts in that folder, I can type:</p><pre>setwd(&quot;/Users/hel/Desktop/R_Practice&quot;)</pre><p>Now, all of the scripts I create in my current R session will be saved to that folder.</p><p>A “Project” in RStudio operates kind of like a folder in that it’s an organizational tool. It’s a way to organize all your R scripts, working directories, source files, history, and workspaces. You can use RStudio without specifying a project, but if you want to keep work context separate, you can click on the Project dropdown in the upper right corner of the IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*zmLN4ZPHtn5LZYQ1R9IZqw.png" /><figcaption>You can create a new project, open an existing project in your current session, or open an existing project in a new session, which will just open an additional RStudio instance.</figcaption></figure><p>You can create a project at any time, so if you’ve already started coding, you have the option to associate your project with your current working directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sAUYCiZggEUuEIemz725Ig.png" /><figcaption>Click on New Directory, New Project, and then give your project a name and save it somewhere on your computer. You then have the option to open your project in a new R session.</figcaption></figure><p>If you select “Version Control”, you’ll see that you can actually clone a repository from Github and convert it to an R Project. Then, you can use this project to push, pull, and commit code directly from the IDE. Depending on your use case, setting this up may require some git personal access tokens (PAT) and R’s “credentials” package. More on this later.</p><p>Overall, I’d recommend spending some time clicking around in the IDE and getting comfortable with all of its features. If you’re a first-time coder, R is a great first language to learn. The basic syntax is easy to pick up, and the documentation is pretty standardized and well-maintained. However, R functions very differently under the hood than languages like Python or Java, so if you’re a more traditional coder/developer/engineer, this is going to be different for you (especially if you start trying to set up CI/CD pipelines).</p><blockquote><strong>To gain more hands-on coding practice in R, see my </strong><a href="https://github.com/HelenaBelloff/Intro_to_R.git"><strong>Intro to R repo on Github</strong></a><strong>. Good luck!</strong></blockquote><p>This guide began as a simple, informal text file on my computer — a personal reference for navigating R. Over time, it has been shared among colleagues, passed through universities, and circulated across companies, evolving with each handoff. It’s a living document, always a work in progress, shaped by contributions and feedback from its many users. Your input is always welcome to keep it growing and improving!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=988c77e8f3fe" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/a-very-informal-guide-to-r-programming-988c77e8f3fe">A Very Informal Guide to R Programming</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>