<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mungai Keren</title>
    <description>The latest articles on DEV Community by Mungai Keren (@mungaikeren).</description>
    <link>https://dev.to/mungaikeren</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F310822%2Fefae23ce-5077-4858-9284-80aadcb4a420.jpeg</url>
      <title>DEV Community: Mungai Keren</title>
      <link>https://dev.to/mungaikeren</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mungaikeren"/>
    <language>en</language>
    <item>
      <title>Why taking that bug break is important.</title>
      <dc:creator>Mungai Keren</dc:creator>
      <pubDate>Tue, 12 Nov 2024 14:10:40 +0000</pubDate>
      <link>https://dev.to/mungaikeren/why-taking-that-bug-break-is-important-1epd</link>
      <guid>https://dev.to/mungaikeren/why-taking-that-bug-break-is-important-1epd</guid>
      <description>&lt;p&gt;A software &lt;strong&gt;BUG&lt;/strong&gt; is an error, a flaw or a fault in a computer program that makes it not to run as expected. Believe it or not some bugs are ‘nice’ they are the reasons as to why some of the applications created have certain features that you’ll hear the developer saying “I don’t know why this piece of code works, but without it, it doesn’t work!” In any case, some bugs could be documented. So do documented bugs become features?&lt;/p&gt;

&lt;p&gt;Well, bugs are undesired, frustrating, gross! They can lead to head-slapping embarrassment, desk-pounding frustration, The OMG moments…or a gnawing realization that you’re not learning from your old mistakes. All of those are key moments in the growth path of any developer. They can be the pause that refreshes the product. A serious bug can take a lot of time and effort to track down and if nothing else they stop the “new feature” race, long enough for everyone to breathe a little, and think about some refactoring, testing/debugging/monitoring infrastructure, and the like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv47zhzw8e72br8u4ncd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv47zhzw8e72br8u4ncd.jpg" alt="Photo by Tim Gouw on Unsplash" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An error could be as a result of anything, typos, poor design login, communication failure, lack of skilled testing, mention them all. Some bugs are easy to deal with, well as you run your code the terminal throws an error could be a 400 or 500 error and StackOverflow could get you covered, but other errors are complicated. Have you found yourself in a situation where the smartest debugger in the room can’t figure out what is wrong with your code and they even say that they have never seen anything like that before? Trust me if you are working on a deadline, you’ll freak out!&lt;br&gt;
&lt;strong&gt;Here are some of the reasons as to why taking that break when it gets buggy is important.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Enhances productivity&lt;/strong&gt;.&lt;/em&gt; Productiveness at work is one of the key things that you want to achieve at your work. A bug could be a barrier to that and you don’t want to be disappointed with coding especially when learning it. Every time you take that 5-minute toilet break or grab a coffee at the java house when you have a bug could save you a million. You’ll come back refreshed and less anxious about it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;_*&lt;em&gt;Improves code quality. *&lt;/em&gt;_One of the most important things to developers is writing quality code. Code that is reusable, can be well maintained, readable and one that is not prone to errors. Now this calls out loud for testing. Taking a break from the errored code could call for better methods to write it and the code actually becomes better. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Helps you socialize.&lt;/em&gt;&lt;/strong&gt; Some developers are well-known to be introverts. Taking too much time on your computer could cause you a breakdown especially when you are burnt out! So you better checkout. Go talk to that new colleague at your company and show them around. You could save a friend on a rainy day.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Makes you ‘fall in love with coding.’&lt;/em&gt;&lt;/strong&gt; I don’t know about you but the feeling that accompanies a solving error is sensational. It makes you feel there’s progress that you are making towards becoming a better programmer. In fact, passion is developed and one likes it when the challenge goes on and on, and you become the hard nutcracker!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Saves time.&lt;/em&gt;&lt;/strong&gt; Some bugs take a relatively huge amount of time to solve than others. This could be dependent on various factors; a senior developer could be in a position to know when something is about to go wrong than a junior developer. Depending on the intensity of the bug, one could take a whole hour trying to figure out what is wrong. At the same time, you could take 2 minutes to identify and solve a bug if you took a break.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77buns0hw9in79s26sbo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77buns0hw9in79s26sbo.jpg" alt="Image description" width="800" height="982"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Makes you become ‘the debugger.’&lt;/em&gt;&lt;/strong&gt; I learnt how to code in a Bootcamp and one of the things that made one outstanding is being able to debug someone else’s code. Well, once you face an obstacle and overcome it and you walk around the room debugging other people's code not only helps you understand the problem more but you get an opportunity to learn different other methods of solving the same problem.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>help</category>
    </item>
    <item>
      <title>Missing Values in R — remove na values</title>
      <dc:creator>Mungai Keren</dc:creator>
      <pubDate>Tue, 12 Nov 2024 13:39:20 +0000</pubDate>
      <link>https://dev.to/mungaikeren/missing-values-in-r-remove-na-values-b7i</link>
      <guid>https://dev.to/mungaikeren/missing-values-in-r-remove-na-values-b7i</guid>
      <description>&lt;p&gt;&lt;strong&gt;The first method — is.na()&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;is.na tests the presence of missing values or null values in a data set. The method searches through every single column of the dataset, finding outliers with a na value that might affect the calculation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Example;&lt;br&gt;
&lt;br&gt;
&lt;code&gt;x &amp;lt;- c(1,2,3,4,NA) is.na(x) returns a series of FALSE and TRUE depending on whether the values of the vector have na values. The output in this case would be FALSE FALSE FALSE FALSE TRUE&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs3uk7d31q65maqw4e3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs3uk7d31q65maqw4e3d.png" alt="Image description" width="265" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second method — na.omit()&lt;/strong&gt;&lt;br&gt;
Here’s a sample dataset with missing values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmh43y7dea6pmq6le9u0s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmh43y7dea6pmq6le9u0s.png" alt="a dataset with missing values. Screenshot from R studio." width="683" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;na.omit() method removes the rows with na values from a list. The na.omit() function returns a list without any rows that contain na values. This is the faster way to remove na values in R.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu43ic2saosgichrddgap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu43ic2saosgichrddgap.png" alt="Image description" width="685" height="615"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complete cases complete.cases() — Returns vector of rows with na values.&lt;/strong&gt;&lt;br&gt;
The na.omit() function relies on the sweeping assumption that the dropped na rows are similar to the typical member of the dataset, and are not total outliers whereas the complete.cases() allows you to perform a more detailed review and expression.&lt;/p&gt;

&lt;p&gt;Removing the na rows in a dataset might not be the right decision here and we might therefore consider inspecting datasets of the original data to evaluate if other factors are at work.&lt;/p&gt;

&lt;p&gt;We accomplish this with the complete.cases() function. This R function will examine a data frame and return a result vector of the rows which contain missing values. We can examine the dropped records and purge them if we wish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6jexlorjhbsecsdaybd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6jexlorjhbsecsdaybd.png" alt="Missing values removed using the complete.cases() function." width="550" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup6o9n99elulf285mgwf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup6o9n99elulf285mgwf.png" alt="A display of the removed missing values which can be examined." width="547" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix in place using the na.rm&lt;/strong&gt;&lt;br&gt;
Another way of dealing with missing values is by using the na.rm logical parameter. When na.rm is True, it skips over the na values. However, when the na.rm is False, then it returns NA from the calculation being done on the entire row or column.&lt;/p&gt;

&lt;p&gt;The rows with the value of na are retained in the data frame but excluded in relevant calculations. This is often the best method if you find that there are significant trends in the observation, with na values. Support for this varies by package so please check the documentation for your specific package.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa62qa5oi7k4zw3b1vr6v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa62qa5oi7k4zw3b1vr6v.png" alt="notice the na value on the rowSums because we had an na value in the dataset on column 2 row 2" width="695" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dealing with missing data from a dataset is critical to proper data science. R makes dealing with this missing data so easy that's why it is often used in statistical analysis.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>datacleaning</category>
      <category>computerscience</category>
      <category>missingdata</category>
    </item>
  </channel>
</rss>
