<?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 Daniel DiNicola on Medium]]></title>
        <description><![CDATA[Stories by Daniel DiNicola on Medium]]></description>
        <link>https://medium.com/@danielleodinicola?source=rss-975f3a928eac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*sOU--QrUxEIiE5dD.jpg</url>
            <title>Stories by Daniel DiNicola on Medium</title>
            <link>https://medium.com/@danielleodinicola?source=rss-975f3a928eac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 23:20:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danielleodinicola/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[Learning R]]></title>
            <link>https://medium.com/@danielleodinicola/learning-r-8fe64a2509b1?source=rss-975f3a928eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fe64a2509b1</guid>
            <dc:creator><![CDATA[Daniel DiNicola]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 03:45:20 GMT</pubDate>
            <atom:updated>2023-12-18T03:45:20.224Z</atom:updated>
            <content:encoded><![CDATA[<p>What is the path for someone looking to learn a new programming language? Well Udemy of course. Over the past week I worked through “R Programming from A-Z,” and would like to share what I have learned.</p><p><strong>Core Programming Principles:</strong></p><p>In many courses in R students are thrown into the deep end regarding vector or matrices mathematics. However, since I have never written a for, or while loop in this programming language I thought it important to at least feel the keystrokes as I make them. So, to advanced programmers reading this you can skip this section.</p><p><strong>Types of Variables:</strong></p><p>We create variables by using the less than an arrow sign (&lt;-). There are five main types of variables that this course covers which are described below.</p><p>· Integer — set of all integers in a set such as 42L.</p><p>o X &lt;- 42L</p><p>· Numeric or Double — this would be a value such as 2.87, essentially it all set of real numbers.</p><p>o Y &lt;- 2.5</p><p>· Logical — this is a variable that reduces to either True or False.</p><p>o Q1 &lt;- True</p><p>· Character — it could be a message but must be characters as opposed to any numbers.</p><p>o Char_variable &lt;- “Hello World”</p><p>· Complex — this variable is usually a set of complex numbers or a function such as</p><p>o complex_variable &lt;- 1 + 2x</p><p>Using variables is another straightforward adventure for beginners in programming the R language. As you can see in the graphic below to add variables need not be repeated or storing results of operations of two separate variables, all of this follows the same functionality of languages such as Python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*vwlf6sOkEwpZGkdwIqs6cg.png" /></figure><p><strong>While Loop, For Loop and IF Statement Structure</strong></p><p>Now onto the discussion of two pillars of programming the for and while loop and here we get some distinctions between python and R.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*o6S72sZhD-UzNLKtb-cWww.png" /></figure><p>In a for or while loop we do have to use these brackets {} which denote the command portion of the code. In python we simply end the iterative part of the loop with a colon and type out the rest of the code/command. Note that in the last for loop such code will produce 6 iterations of “Hi” as opposed to five since 5 through to 10 has 6 occurrences.</p><p>When it comes to IF, ELSE statements we also get a slight variation on what we normally use in python. As the picture below shows in R we must close off each conditional statement with the {} brackets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*fkPOerQG4Vt2erH6KxpCHQ.png" /></figure><p><strong>Creating Vectors</strong></p><p>As touched upon in previous sections, creating vectors in R is slightly different from that in python. In reference to Python using NUMPY one can make either vertical or horizontal vectors using the square brackets []. In R all one needs to create a vector is to set a variable equal to a set of integers, doubles etc and the way you denote that is to put all of those values within the c() function. Please see below for examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*INe8__2HDmy1lAIoRbWpZQ.png" /></figure><p>Some additional notes about vectors you can not mix types in a vector and if you do the erroneous types of the minority will be converted the to the type of the majority. When you test the vector below you find that all of the elements are character elements since the 7 as an integer type is in the minority.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*CyDeG6S8Bc6YewS-juZb8w.png" /></figure><p>What if I want to access a specific element of a vector? You use the square brackets. Unlike python where the first element in a vector is denoted by the number zero, in R the first element of a vector is denoted by the number 1. Furthermore, you can use negative numbers in square brackets to receive all elements in a vector besides the numbered element you have made negative. You can also take a range of elements in a vector by using the colon character. You can also use the combine function to retrieve multiple elements from the vector. Examples below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*5DZ7AUgRCef-l61Np0RHjg.png" /></figure><p><strong>Vectorized Operations</strong></p><p>But of course, it is difficult to discuss the R programming language without talking about vectorized operations in R. Luckily in R one does not need to loop through vectors to perform some sort of collectivized action on two vectors in a situation where we were say adding them together. If the two vectors are not of the same size R will engage in a process called recycling the vector where values from the smaller vector are repeated until the vectors are matched in size.</p><p>Another critical element of this conversation is describing the difference between vectorized and de-vectorized operations. Let’s discuss the code below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*viA71BHnfZTo-8NxxKGBAw.png" /><figcaption>Both sets of code create the same result, however the vectorized approach where we do not use loop over each element of vectors a and b is faster than the devectorized approach since that method creates an empty vector which allocates memory and subsequently needs to fill it. Secondly, in the devectorized approach since R needs to be sure that all elements of the vector are the same it must check each element one by one while the vectorized approach does not. This is a critical coding practice anyone creating code in R needs to understand. In other programming languages, C and Julia this is flipped where devectorized approaches are quicker in their production.</figcaption></figure><p>Both sets of code create the same result, however the vectorized approach where we do not use loop over each element of vectors a and b is faster than the devectorized approach since that method creates an empty vector which allocates memory and subsequently needs to fill it. Secondly, in the devectorized approach since R needs to be sure that all elements of the vector are the same it must check each element one by one while the vectorized approach does not. This is a critical coding practice anyone creating code in R needs to understand. In other programming languages, C and Julia this is flipped where devectorized approaches are quicker in their production.</p><p><strong>A Quick Note on Packages:</strong></p><p>Many people who use R for the first time might start to believe that a package is a library because we activate a package through the library function, but this is not the case and do not get that mixed up in your head.</p><p><strong>Matrices</strong></p><p>Even though knowing how to work with vectors is good knowledge, much data we receive in modern days is in table or matrix form, with multiple columns and rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*uN2uPiybdtqhq4xl5D0Wnw.png" /><figcaption>So, let’s imagine we have a matrix like this. How do we access the zero in this table? We do so by conforming to ideas of subsetting within R.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*6sDa4HuuxYluKCWkt0LSvg.png" /></figure><p>As we can see the added context gives us the answer. In R syntax to access a cell within a matrix we denote the row first within the square brackets and then the column like this [3,4]. If we wanted to just access a column for this matrix and let’s call it matrix A we would put this into R A[,5]. As you can see, we do not put anything where we would denote the row but instead just place the column you wish to receive, and R will produce the vector that is left for you.</p><p><strong>Building a Matrix</strong></p><p>There are three main functions we use to create matrices in R, rbind, cbind and matrix. Beginning with the matrix function we can see in the snapshot below what the inputs are for the matrix function; it is pretty simple first argument it is asking for is the data and the second argument is how many rows do you want followed by how many columns do you want and whether or not you want to fill the datarame by rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*ZYP62IeBdYVKCRPd_-si-w.png" /><figcaption>Arguments for the Matrix function in R</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*t3zAwu_Hhz7VouCpoDSwZg.png" /><figcaption>How we use the matrix function</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*j4pciV734KhrEHKQfCP50w.png" /></figure><p>As you can see the numbers wrap around like a snake by row as opposed to going up and down by column when we left the by_row argument empty. Now let’s try rbind() function. As we can see with the example below the rbind function takes each vector and uses it as a representation of an individual row. Note when we use the cbind function we get the opposite each vector is now a column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*26XHafciFm_XPMzEzLjNzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*-ddqgs02EUKzPE0W7wk0ew.png" /></figure><h3>Matrix Operations</h3><p>For this next session I will be using an imported data set from the course which has NBA statistics over several years. Just like with vectors we can do an easy operation amongst matrixes. In this example I will simply divide the field goals matrix by the games matrix and take a look at the result while using the round function to make it cleaner.</p><pre>FieldGoals / Games</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*eksVBBE15fEDaZZAOCe61w.png" /><figcaption>As we can see the late Kobe Bryant was consistently near the top of field goals per game.</figcaption></figure><h3>Using Matplot ()</h3><p>Matplot is used to plot the columns of one matrix against the columns of another (which often is just a vector treated as 1-column matrix). This function is not used excessively but it does have several use cases. Let’s say we want to plot the field goas in our basketball data. Well the first thing we need to is transpose the data set to ensure we are plotting the players and not the years.</p><pre>#We use the transpose function which is just t to flip the rows and columns<br>#in the matrix<br>#pch argument sets the size of the picture <br>#col argument picks the colors<br>#legend allows you determine the location size and colors of the legend<br>matplot(t(FieldGoals), type = &quot;b&quot;, pch=15:18, col=c(1:4,6))<br>legend(&quot;bottomleft&quot;, inset=0.01, legend=Players, col = c(1:4,6), pch = 15:18, horiz=F) </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wn_dcJ9uefYbeI9qVbkaHA.png" /></figure><h3>Subsetting</h3><p>A first good rule to remember is whenever you subset a vector using square brackets you get back a vector; R will always store this as a vector. The same can not be said of matrices. Remember R is a language for statisticians and mathematicians there is always going to be a tradeoff between coding procedures and analysis of data. When we receive a non tow dimensional subset of a matrix R will return back a vector.</p><pre>#Note that in both exampes we are only taking a one row subset <br>#So no two dimensional returns <br><br>is.matrix(Games[1,])<br>#Return False<br>is.vector(Games[1,])<br>#Returns True</pre><p>How do you get around this? When you subset you can set the drop argument to False. If you keep the drop argument to True which it is pre-set too it will drop unnecessary dimensions making your return a vector.</p><pre>is.matrix(Games[1,,drop=F])<br>#Return True </pre><h3>Visualizing Subsetting</h3><p>This reality is important when visualizing subsets. Let’s say we want to visualize NBA minutes played statistics for just the top 3 players in our matrix.</p><pre>Data &lt;- MinutesPlayed[1:3,]<br>matplot(t(Data), type = &quot;b&quot;, pch=15:18, col=c(1:4,6))<br>legend(&quot;bottomleft&quot;, inset=0.01, <br>       legend=Players[1:3], col = c(1:4,6), <br>       pch = 15:18, horiz=F)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*v5QKuA9-Ro99Af4F7HFxrg.png" /><figcaption>This is the result of that code</figcaption></figure><p>Now let’s say we just want to visualize the minutes played of Kobe Bryant. We can not forget to place the drop function as false so R does not turn our data into a vector.</p><pre>Data &lt;- MinutesPlayed[1,,drop=F]<br>matplot(t(Data), type = &quot;b&quot;, pch = 15:18, col=c(1:4,6))<br>legend(&quot;bottomleft&quot;, inset = 0.01, legend = Players[1], col=c(1:4,6), pch = 15:18, horiz=F)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*bI5jIYMph2fRAdV7GstnAw.png" /><figcaption>We get the following result when we ensure that the Data variable returns a matrix.</figcaption></figure><h3>Creating Functions</h3><p>Creating a function is a straightforward proces which starts with the command function(){ <em>code </em>}. That is a basic syntax but of course normally we want to have inputs in a function to change that allows us to get different results, so it would look something more like this, function(<em>input1, input2, etc</em>){ <em>code </em>}. Let’s create a quick example.</p><pre>#You can see this code takes two arguments data and rows<br>#When we run the function I&#39;ll use the games data set and the first ten rows<br><br>myplot &lt;- function(data, rows){<br>  Data &lt;- data[rows,,drop=F]<br>  matplot(t(Data), type = &quot;b&quot;, pch = 15:18, col=c(1:4,6))<br>  legend(&quot;bottomleft&quot;, inset = 0.01, legend = Players[rows], col=c(1:4,6), pch = 15:18, horiz=F)<br>}<br><br>myplot(Games, 1:10)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*qsoXTGOv12qmGcUc2KsKYg.png" /><figcaption>And Here is the Result</figcaption></figure><h3>Working With Data Frames</h3><p>The first thing one needs to do to work with data frames in R is import the data. Luckily for this python user it is essentially the same command of read.csv. I will be looking at some demographic data and use some generic functions to dig a bit deeper into the data. Let’s take a look at the code.</p><pre>#Let&#39;s read in our data<br>stats &lt;- read.csv(file.choose())<br>#Let&#39;s see how many rows we have <br>nrow(stats)<br>#Let&#39;s see how many columns we have <br>ncol(stats)<br>#Let&#39;s see the top 6 rows<br>#You can change this by setting n=x<br>head(stats)<br>#Let&#39;s see the bottom 6 rows <br>#You can change this by setting n=x<br>tail(stats)<br>#Now let&#39;s check out the internal structure of the objects<br>str(stats)<br>#Now let&#39;s look at some summary statistics <br>summary(stats)</pre><h4>Using the $ Sign</h4><p>We use the $ sign to access data in a data frame, and it does not work with matrices.</p><pre>#This will return an entire column from a dataframe in this case Internet Users<br>stats$Internet.users<br><br>#This will return the second row value for the same column<br>stats$Internet.users</pre><h4>Basic Operations With A Data Frame</h4><pre>#Let&#39;s do some subsetting<br>#Let&#39;s get the first ten rows of each column<br>stats[1:10,]<br><br>#Let&#39;s get the fourth row and the 100th row of all columns<br>stats[c(4,100),]<br><br>#Remember how the [] work <br>#If you are extracing just a row it stays a data frame <br>is.data.frame(stats[1,]) #no need for drop=F<br>#Returns True<br><br>#This result will not be a data frame and you need to add drop=F<br>is.data.frame(stats[,1]) <br>#Returns False <br><br>#add a column<br>stats$MyCalc &lt;- stats$Birth.rate * stats$Internet.users<br><br>#remove a column<br>stats$MyCalc &lt;-NULL</pre><h4>Filtering a Data Frame</h4><p>Filtering data allows us to examine certain subsets of data on a provided condition. Let’s look at an example of a few simple filters that allows us to look at our demographic data in a deeper way.</p><pre># I want to look at countries with a low amount of internet users <br>filter &lt;- stats$Internet.users &lt; 2<br><br># Now I can use that variable on the data frame to look at the data in a <br># different way <br><br>stats[filters, ]<br><br># You can also use the levels function on the data frame to get the groupings <br># Of a non numerical columns <br><br>levels(Stats$Income.Group)<br><br># This returns High Income, Low Income, Lower Middle Income, Upper Middle Income</pre><p>It looks simple but this a powerful approach in R.</p><h4>QPlot Visualizations</h4><p>Qplot which stands for quickplot is a function within ggplot2 and is similar in many ways to create and combine different type of plots easily, however it remains less flexible than the function ggplot. Let’s make some quick visualizations.</p><pre>#Categorical Data on the X-axis and <br>#Numberical data on the Y-Axis <br>#Size maps the <br>#If you want to assign a value in qplot<br>#You need to use the letter I to change the value<br>qplot(data=stats, x=Income.Group, y=Birth.rate, size=I(3))<br><br>#Let&#39;s make a quick boxplot <br>qplot(data=stats, x=Income.Group, y=Birth.rate, geom = &quot;boxplot&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtmWBNWQBPGAJXvw3g09AQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2KwK-y3IwFu_g91rsfdtw.png" /></figure><pre>#Something More Advanced<br><br>#1. Shapes<br>qplot(data=stats, x=Internet.users, y=Birth.rate, <br>      colour=Income.Group, size=I(4), shape=I(23))<br>#2. Transparency <br>qplot(data=stats, x=Internet.users, y=Birth.rate, <br>      colour=Income.Group, size=I(4), shape=I(23),<br>      alpha=I(0.6))<br>#3. Title <br>qplot(data=stats, x=Internet.users, y=Birth.rate, <br>      colour=Income.Group, size=I(4), shape=I(23),<br>      alpha=I(0.6), main = &quot;Birth Rate Vs Internet Users&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zt--7nNnw5kZEiCgSLmkqA.png" /><figcaption>Seems like the more internet users there are the lower the birth rate.</figcaption></figure><h4>Merging DataFrames</h4><pre># We merge data using the merged function<br># The df we want to merge from the left goes first, stats in this case<br># The DF we merge on the left goes second <br># The column we are merging from the data frame on the left goes by.x<br># The DF we merge from the left goes by.y <br><br>merged &lt;- merge(stats, mydf, by.x = &quot;Country.Code&quot;, by.y=&quot;Code&quot;)</pre><h3>GGPlot2</h3><p>Now we get to GGPlot, and I think it goes without saying GGPlot is an enormously powerful tool and I will show several different blocks of code to reflect elements that I found interesting. In this example I used a movie rating dataset to create a plot which compared critic and audience ratings while judging the size by the budget of the film.</p><pre>#Note the size variable is filled with one of our columns <br>ggplot(data = movies, aes(x=CriticRating, y=AudienceRating, <br>                          colour=Genre, size=BudgetMillions)) + geom_point()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c4bFm-Ld_PUigByOJwzILA.png" /></figure><h4>Using Layers</h4><pre>#Let&#39;s first save our previous plot <br>p &lt;- ggplot(data = movies, aes(x=CriticRating, y=AudienceRating, <br>                               colour=Genre, size=BudgetMillions)) + <br>  geom_point()<br><br>#Now let&#39;s create multiple layers<br>p + geom_point() + geom_line()<br>p + geom_point() + geom_line()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VL-08SYmqTJy-L0GXPa9ZQ.png" /></figure><h4>Overriding Aesthetics</h4><pre>#-------Overriding Aesthetics<br><br>q &lt;- ggplot(data=movies, aes(x=CriticRating, y=AudienceRating, colour=Genre, <br>                             size=BudgetMillions))<br>#add geom layer<br>#geom point inherits the aesthetics of q<br>q + geom_point()<br>#we can ovveride the aesthetics <br>q + geom_point(aes(colour=BudgetMillions))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*DOl71TA1FD54gIgSeqIPUg.png" /></figure><h4>Histograms and Density Charts</h4><pre>#------- Histograms and Density Charts<br><br>s &lt;- ggplot(data=movies, aes(x=BudgetMillions))<br>s + geom_histogram(binwidth = 10)<br><br>#add colour <br>s+ geom_histogram(binwidth = 10, aes(fill=Genre))<br>s+ geom_histogram(binwidth = 10, aes(fill=Genre), colour=&quot;Black&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSU1CAyv9r6y4Nf5Rq9NXg.png" /></figure><h4>More Layers</h4><pre>#----- Starting Layer Tips<br>t &lt;- ggplot(data=movies, aes(x=AudienceRating))<br>t + geom_histogram(binwidth = 10, fill=&quot;White&quot;,<br>                   colour=&quot;Blue&quot;)<br>#Another Way:<br>t &lt;- ggplot(data = movies)<br>t + geom_histogram(binwidth = 10,<br>                   aes(x=AudienceRating),<br>                   fill=&quot;White&quot;, colour=&quot;Blue&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*FMjPg8bUQxOuCNBSacEXrA.png" /></figure><h3>Conlusion</h3><p>After two weeks and ten plus hours of this course I can’t imagine trying to fit all of the things I learned, however I encourage anyone who is in the larger field of data to keep learning, keep coding and keep up the spirits.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fe64a2509b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Can Natural Language Processing Teach Us About Fake News?]]></title>
            <link>https://medium.com/@danielleodinicola/what-can-natural-language-processing-teach-us-about-fake-news-c0310a66bcdb?source=rss-975f3a928eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0310a66bcdb</guid>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[fake-news]]></category>
            <dc:creator><![CDATA[Daniel DiNicola]]></dc:creator>
            <pubDate>Thu, 02 Jul 2020 22:25:44 GMT</pubDate>
            <atom:updated>2020-07-02T22:25:44.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*l3NnW72ozYNA1bfzWp65TQ.jpeg" /><figcaption>Sourced From: Getty Images and BBC</figcaption></figure><p>Fake news is a problem. It radicalizes, it polarizes and infuses in our discourse points of view which do not exist. Just about this time last year, a <a href="https://www.theatlantic.com/ideas/archive/2019/06/fake-news-republicans-democrats/591211/">pew research poll</a> found that some Americans believe that false news is a more significant issue than racism, terrorism, and illegal immigration.</p><p>However, when you take a step back, the issue derives from a multitude of potential sources. Nation-states engage in the practice to foment chaos in other countries, and political actors push ideas to increase or decrease voter participation.</p><p>Today, the novel coronavirus or COVID-19 has put a halt to our economy and claimed the lives of thousands around the world. Such an issue one would hope should be beyond the maleficence of disinformation is a global pandemic. Unfortunately, that is not the case; the World Health Organization has described the phenomenon as an infodemic.</p><p>Amid this infodemic, an online community arose, which I joined looking to tackle and understand further the differences between fake news and trustworthy news about COVID-19. The rest of this article discusses the work colleagues, and I did to uncover patterns about fake news regarding COVID-19.</p><h3>Data Collection</h3><p>The Poynter Institute for Media Studies is a non-profit journalism school and research organization located in St. Petersburg, Florida. In an attempt to help combat disinformation about the coronavirus, the institution in January set up an alliance that united more than 100 fact-checkers worldwide to coalesce fake news stories on the virus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LOH0t60YISUbc3zJSyxsA.png" /><figcaption>Sourced From: <a href="https://www.poynter.org/ifcn-covid-19-misinformation/?covid_countries=48837&amp;covid_rating=0&amp;covid_fact_checkers=0">https://www.poynter.org/ifcn-covid-19-misinformation/?covid_countries=48837&amp;covid_rating=0&amp;covid_fact_checkers=0</a></figcaption></figure><p>With the help of some great computer scientists, our team was able to scrape 983 instances of these stories and place them into a data frame. For the real news portion of this project, I used the <a href="https://newsapi.org/">News API</a>, where you can contain your search to specific news organizations and topics. Of course, for this endeavor, I came to the main-stream news organizations in the United States and kept the topic to coronavirus. The result was a data frame of 1983 rows, 1000 of which I categorized as “Real” news and 983 as “Fake” news.</p><h3>Word Cloud</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KCehc_e8spNvzRrlBhCDhA.png" /><figcaption>It’s not a real NLP project without a word cloud.</figcaption></figure><h3>Pre-Processing</h3><p>This data set did not require any noise-removal, so; I ran through some of the basics for textual data.</p><ol><li>Removing all punctuation.</li><li>Making all words lowercase.</li><li>Creating a Text column which as a list type.</li><li>Stemming and creating a new column.</li><li>Lemming and creating a new column.</li></ol><pre>#Create a binary target <br>df[&#39;Label&#39;] = df[&#39;Label&#39;].map({&#39;Real&#39;:0, &#39;Fake&#39;:1,})</pre><pre>#Remove all punctuation from our text data<br>df[&quot;Text&quot;] = df[&#39;Text&#39;].str.replace(&#39;[^\w\s]&#39;,&#39;&#39;)</pre><pre>#Make sure all the words are lowercase.<br>df[&quot;Text&quot;] = df[&quot;Text&quot;].str.lower()</pre><pre>#Create our text column into one where it is just a list of words<br>df[&quot;Text_as_list&quot;] = df[&quot;Text&quot;].str.split()</pre><pre>#Create our stemmed data<br>df[&#39;stemmed_text&#39;] = df[&#39;Text_as_list&#39;].apply(lambda x: [stemmer.stem(y) for y in x])</pre><pre>#Create our lemmed data<br>df[&#39;lemmed_text&#39;] = df[&quot;Text_as_list&quot;].apply(lambda x: [lemmer.lemmatize(y) for y in x])</pre><p>Now that’s done, let’s talk about modeling and the results.</p><h3>Modeling</h3><p>Pipelines and grids are great tools. Since I want to enable both CVEC and TFIDF vectorizers setting up a pipeline allows me to utilize fit/transform/predict functionality to the training data and transform the test data without having to do it individually.</p><p>Also, the parameters set within the pipeline will be broad. I varied n-gram range from (1,2), (1,3), and (1,4). I set the max_df parameter to range from 75% to 95% since this would create options where words like “coronavirus” are excluded from that particular model’s decision. You can see the full pipeline below.</p><pre>pipe_c_lr = Pipeline([(&#39;cvec&#39;, CountVectorizer()),<br>                  (&#39;lr&#39;, LogisticRegression(solver = &#39;liblinear&#39;))<br>                  ])</pre><pre>pipe_para_cvec = {<br>    &#39;cvec__max_features&#39;: [100, 500, 1000],<br>    &#39;cvec__ngram_range&#39;: [(1,2), (1,3), (1,4)],<br>    &#39;cvec__stop_words&#39; : [&#39;english&#39;, None],<br>    &#39;cvec__min_df&#39;: [2, 5, 10],<br>    &#39;cvec__max_df&#39;: [.75, .80, .85, .95]<br>    }</pre><pre>pipe_t_lr = Pipeline([(&#39;tvec&#39;, TfidfVectorizer()),<br>                  (&#39;lr&#39;, LogisticRegression(solver = &#39;liblinear&#39;))<br>                  ])</pre><pre>pipe_para_tfidf = {<br>        &#39;tvec__max_features&#39;: [100, 500, 1000],<br>        &#39;tvec__ngram_range&#39;: [(1,2), (1,3), (1,4)],<br>        &#39;tvec__stop_words&#39;: [&#39;english&#39;, None],<br>        &#39;tvec__min_df&#39;    : [2, 5, 10],<br>        &#39;tvec__max_df&#39;    : [.75, .80, .85, .96]<br>        <br>}</pre><p>I iterated over these pipes. I used the grid search optimization algorithm to help select the best parameters as a sort of trial and error method.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*8c784-VU_YvymysKAV8NJw.png" /></figure><p>For classification problems like this, which I equated to detecting spam emails, one has to ask themselves what the goals are?</p><p>Since we are not predicting if someone has a disease and or classes our balanced, I wanted to examine further a model that minimized false positives and had the highest accuracy score. Expectedly, this happened in two separate models. Nevertheless, when reviewing the results, I decided to look into feature importance for the XGBoost to see if there is anything to communicate back to the public on the nature of fake and real news.</p><h3>SHAPLEY Values and Feature Importance</h3><p>I want to preface that there is someone out there who can explain SHAPLEY values better than I can. With that said, I still believe that in the world of model explainability, this tool is critical. To me, SHAP values quantify the impact of having a given feature in comparison to the prediction we’d make if that feature took some baseline value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*0enp6bF9h3FfOtjjp5ldFQ.png" /><figcaption>XGBoost SHAP Value Chart</figcaption></figure><p>What we see above are the features or words which have the highest average impact on the model’s output magnitude. The first word, “financial,” has an extremely high correlation with the desired output of a real news classification.</p><p>What does that mean in English? Articles with the word “financial” significantly impact the decision making of the model to classify that story as real. Furthermore, terms like update and stimulus also rank high up on the list as affecting the model’s decision making.</p><p>What can we learn from this, and how do we use this to inform the public?</p><p>Essentially, what this data shows is that if a news story contains key-words like “financial,” “update,” or “stimulus,” then you are more than likely reading a story whose information you can trust.</p><h3>GitHub Link</h3><p><a href="https://github.com/Daniel-Lazi00816/covid-19_fake_news_classifier">Daniel-Lazi00816/covid-19_fake_news_classifier</a></p><h3>Check Out More of My Work Here</h3><p><a href="https://daniel-lazi00816.github.io/">Resume - Start Bootstrap Theme</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0310a66bcdb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Web Scraping Can Aid Your Job Search]]></title>
            <link>https://medium.com/@danielleodinicola/how-web-scraping-can-aid-your-job-search-c17c94ec93cb?source=rss-975f3a928eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/c17c94ec93cb</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[nltk]]></category>
            <dc:creator><![CDATA[Daniel DiNicola]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 15:34:13 GMT</pubDate>
            <atom:updated>2020-04-23T15:34:13.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*x6nPeJnQgCpjjFZsg0JH3g.png" /></figure><p>For anyone who seeks the title of data analyst or data scientist, they must make their way through that oh-so beloved rite of passage known as web scraping. In this post, we will go over the steps of how to scrape the job-search engine website indeed.com. We are going to keep the scrape simple — all posted data science jobs in New York City.</p><h3>Web Scraping Principles and Ethics</h3><p>Before we jump into all of this, it is prudent to discuss the web-scraping process specifically on a few norms and best practices before you commence.</p><ol><li><strong>Check the terms and conditions of the site you are scraping</strong>. You want to be sure you are not violating any personal agreements. Check out the personal use section of the terms and conditions; it is within that section where one can anticipate to see any prohibitions on acquiring data from a site with or without a written agreement.</li><li><strong>If the site has an API, use the API. </strong>Ok, so maybe I am violating this rule for this blog post, but this is for educational reasons and an effort to hone web-scraping skills. Here is the link to Indeed’s <a href="https://opensource.indeedeng.io/api-documentation/">API</a> for future reference.</li><li><strong>Make sure you do not flood the site with numerous requests in a short time. </strong>Just use a rate and keep it low, especially for learning purposes.</li></ol><h3>Breakdown of Indeed.com</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVQ3tEwFekkq2V9lnfeZ9w.png" /><figcaption>Image provided by indeed.com</figcaption></figure><p>We see here that each job posting is located in a div called result, and will need that bit of information later on as we click through each one of these job postings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QmpCYCHaFuAiTr7Dd-Qvg.png" /><figcaption>Image provided by indeed.com</figcaption></figure><p>One more instance to show you, then let’s start to talk about the actual code. In the image above, we see that the div node with the class distinction of “title” is the location of our job title within the webpage. You will see how this information is crucial when we need to communicate to selenium to check each div class title for the title of our job postings to fill out our data frame.</p><h3>Let’s Take a Look at the Code</h3><p>To get things started, let’s import the correct packages. Users of selenium will be familiar with needing to direct the path of our chrome driver — since we are using google chrome — into the selenium package itself. The rest of our code will just include the creation of the data frame we will soon fill.</p><pre>from selenium import webdriver<br>import pandas as pd <br>from bs4 import BeautifulSoup<br>import matplotlib.pyplot as plt</pre><pre>options = webdriver.ChromeOptions()<br>driver = webdriver.Chrome(“./chromedriver”)</pre><pre>df = pd.DataFrame(columns=[“Title”,”Location”,”Company”,”Salary”,”Sponsored”,”Description”])</pre><p>Remember when we discussed earlier each job posting being under the div element with the term “result” in it. Well, here you can see how we utilize that bit of knowledge using selenium method <em>.find_elements_by_class_name</em> and specifying the search around the term “result.”</p><pre>for i in range(0,500,10):<br>    driver.get(&#39;<a href="https://www.indeed.com/jobs?q=data+science&amp;l=Connecticut&amp;start&#39;+str(i))">https://www.indeed.com/jobs?q=data+science&amp;l=Connecticut&amp;start&#39;+str(i))</a><br>    jobs = []<br>    driver.implicitly_wait(4)</pre><pre>for job in driver.find_elements_by_class_name(&#39;result&#39;):</pre><pre>soup = BeautifulSoup(job.get_attribute(&#39;innerHTML&#39;),&#39;html.parser&#39;)</pre><p>Let’s use a for loop to check through five hundred indeed pages in increments of ten.</p><pre>try:<br>   title = soup.find(&quot;a&quot;,class_=&quot;jobtitle&quot;).text.replace(&quot;\n&quot;,&quot;&quot;).strip()</pre><pre>except:<br>   title = &#39;None&#39;</pre><p>As noted above, each job title is nested within a class, which is denoted by the word “jobTitle.” We use soup.find and anchor it on element a while providing the textual distinction in the class we are looking to attain.</p><p>Try and except is an excellent tool for web scrapping, and in my limited time as both a coder and data scientist, I’ve found no better instance of using these commands than when scraping the web. The code is communicating to try and search within each “a” node the “jobTitle” class extract the text, go the next line, find the job title and strip that text as a string. The except aspect of this code is straight forward if the “a” node does not have a class distinction of “jobtitle” just move on.</p><h3>Let’s Look at The Data</h3><p>The result of our scrape is a 222-row data frame. Easy enough, but as a job seeker, I want to know the skills employers are seeking in this current job market. To do so will use knowledge of natural language processing methods to dive a bit deeper and gain an understanding of what skills we need to hone to make oneself more marketable.</p><p>First, let’s make a quick chart to see which companies are hiring data scientists in the city that never sleeps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*UOrRPiyGEEqKTlG8TQHrRA.png" /><figcaption>Top Ten Companies Posting Data Science Jobs in the NYC Area</figcaption></figure><p>A mix of health insurance providers and financial institutions make up a substantial portion of the top companies looking for data science work. It is important to note that here we see only the top ten job posting organizations. At the same time, the data collected via April the 14th showed over sixty companies looking for data scientists.</p><h3>Natural Language Processing Tools</h3><p>Remember the description column initially created within the data frame when we scraped our website, well let’s now put that column to use to gain deeper insights. To obtain those insights, we are going to use the Countvectorizer class of the feature processing library within sklearn.</p><pre>from sklearn.feature_extraction.text import CountVectorizer</pre><pre>cvec = CountVectorizer(stop_words = &#39;english&#39;, ngram_range = (1,1))<br>cvec_company = cvec.fit_transform(df[&#39;Description&#39;])<br>df_cvec = pd.DataFrame(cvec_company.toarray(), columns=cvec.get_feature_names())</pre><pre>plt.xticks(fontsize=16)<br>plt.yticks(fontsize=16)<br>df_cvec.sum().sort_values(ascending = False).head(20).plot(kind = &#39;barh&#39;, figsize=(15,5));</pre><p>With this code block, we have instantiated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*XJiElS6I9eAOxIA7cnrFQw.png" /></figure><p>No surprises here, the most frequent unigram, or one-word instance within the description part of our job scrape is “data.” Even the other words don’t provide for us a lot of information that we didn’t already know. Being experienced is essential from an employer, and words like analysis, machine, statistical, and analytics all make sense in terms of a data science job search.</p><p>I want to dig a little deeper to see if we can find any insights. Let’s search for bi-grams or two-word pairs within our description column.</p><pre>cvec_2 = CountVectorizer(stop_words = &#39;english&#39;, ngram_range =(2,2))<br>cvec_company_2 = cvec_2.fit_transform(df[&#39;Description&#39;])<br>df_cvec_2 = pd.DataFrame(cvec_company_2.toarray(), columns=cvec_2.get_feature_names())</pre><pre>plt.xticks(fontsize=16)<br>plt.yticks(fontsize=16)<br>df_cvec_2.sum().sort_values(ascending = False).head(20).plot(kind = &#39;barh&#39;, figsize=(15,5));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*or07aHeH4EfihKPwKZrzIg.png" /></figure><p>Again this bi-gram counter showing us what two-word pairs are most prevalent within our description column shows how vital machine learning as a skill is in your data science toolbox.</p><pre>cvec_3 = CountVectorizer(stop_words = &#39;english&#39;, ngram_range = (2,2), max_df=.15)<br>cvec_company_3 = cvec_3.fit_transform(df[&#39;Description&#39;])<br>df_cvec_3 = pd.DataFrame(cvec_company_3.toarray(), columns=cvec_3.get_feature_names())</pre><pre>plt.xticks(fontsize=16)<br>plt.yticks(fontsize=16)<br>df_cvec_3.sum().sort_values(ascending = False).head(20).plot(kind = &#39;barh&#39;, figsize=(15,5));</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*d01n-z4lVhbFYTZ9BMdRww.png" /></figure><p>One of my favorite hyperparameters to use in the CountVectorizer method is max_df. The max_df hyperparameter allows us to set an upper limit on the percent occurrences within our corpus. The graph above restricts terms that appear in more than fifteen percent of the job postings. Our list has some interesting observations firstly that A.I. in any capacity is always a good skill to promote. Even seeing data visualization on this list is something anyone looking to break into the industry should note.</p><h3>Conclusions</h3><p>Natural language processing tools are broad in how we want to apply them. This exercise showed some practical ways anyone job searching could refine a portfolio or cover letter to best highlight the skills most employers desire in an employee. Web scraping is much more a defined tactic but one that is necessary to use and sharpen. I hope this post has taught you something, and if you have anything you want to show me feel obliged to reach out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c17c94ec93cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dr. Ignaz Semmelweis and The Importance of Washing Your Hands]]></title>
            <link>https://medium.com/@danielleodinicola/dr-ignaz-semmelweis-and-the-importance-of-washing-your-hands-6be1ff7570fc?source=rss-975f3a928eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/6be1ff7570fc</guid>
            <category><![CDATA[datacamp]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Daniel DiNicola]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 20:59:10 GMT</pubDate>
            <atom:updated>2020-03-23T20:59:10.989Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0g8_4xPIU0GW_5Nauj7jyw.jpeg" /></figure><p>If it took a pandemic to convince you to embrace upstanding hygienic practices then this article is just for you. Whether it be a daily shower, or a thorough tongue scraping, or a toenail trim, personal hygiene habits are at the forefront of a global conversation on halting the spread of Covid-19. The most critical, and most repeated habit we are told to embrace is to wash our hands.</p><p>It is most likely quite difficult for you to even imagine a world where handwashing was not an accepted practice in medicine. Alas, that time period did exist — it was called the 19th century- and luckily for us Dr. Ignaz Semmelweis put an end to all of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1cdyI6v_tJtJD-oxuUs7g.jpeg" /></figure><p>Dr. Semmelweis was a German-Hungarian physician who during his time working at the Vienna General Hospital worked extensively to uncover the causes of <em>childbed</em> fever. Mothers in childbirth were dying at an alarming rate, and the good Doctor, who would go on to be known as the “savior of mothers” was determined to prove that the cause of this illness was the contaminated hands of the doctors.</p><p>Datacamp offers us the opportunity to read in the original data acquired by Dr. Semmelweis and see for ourselves the same results he did all the way back in 1840.</p><h3><strong>Examining The Data</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*RZXpVMEP3pmLDmUOBkZtMw.png" /></figure><p>After a few alterations, our data set is brought in just as you see it on the left. Our clinic column is divided up into two values, clinic one and clinic two. Let’s get a feel for the dichotomy between clinics and if there are any trends that might indicate the treatment of child-rearing patients by either staff.</p><pre># Plot yearly proportion of deaths at the two clinics<br># Where df, yearly1 corresponds to just clinic 1 data, and so on.</pre><pre>ax = yearly1.plot(x=&quot;year&quot;, <br>    y=&quot;proportion_deaths&quot;, <br>    label=&quot;Clinic 1&quot;)<br>yearly2.plot(x=&#39;year&#39;,<br>            y=&#39;proportion_deaths&#39;,<br>            label=&#39;Clinic 2&#39;, ax=ax)<br>ax.set_ylabel(&quot;Proportion Deaths&quot;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*JP4bLc8tmINaPilfgcrTYA.png" /><figcaption>What’s so different at clinic 1?</figcaption></figure><p>The following code gives us this line graph. It’s plain to see that clinic one is losing more patients than clinic two is, but why is this the case?</p><p>The main difference between the clinics was that clinic one was staffed largely by medical students, and clinic two was staffed with mostly midwife students. The midwife students only tended to women giving birth while medical students had duties from the autopsy room just before attending to child delivery services. Semmelweis believed contamination made its way from the postmortem room to the premortem room, so to speak. Semmelweis’ message to the doctors from there on was simple: wash your hands.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F397546031%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F397546031&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F864790665_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="816" frameborder="0" scrolling="no"><a href="https://medium.com/media/4149e2fe3c753989c155d1c98b070c7e/href">https://medium.com/media/4149e2fe3c753989c155d1c98b070c7e/href</a></iframe><p>Semmelweis continued to collect data from his ruling in 1847 for all doctors to was their hands before assisting in childbirth, and we can see the effect in the following line graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*fII1TjhHP6e77N3PRDAWYw.png" /><figcaption>Now that is an improvement.</figcaption></figure><h3>Bootstrap Analysis</h3><p>Again it is obvious from a visual sense that washing hands led to fewer deaths of mothers, but how confident can we be in this statement? To further ensure the validity of Dr. Semmelweis&#39;s analysis let’s conduct a bootstrap analysis which will simulate redoing the data collection by drawing randomly from the data and creating a value to be drawn many times.</p><pre># A bootstrap analysis of the reduction of deaths due to handwashing<br>boot_mean_diff = []<br>for i in range(3000):<br>    boot_before = before_proportion.sample(frac=1,replace=True)<br>    boot_after = after_proportion.sample(frac=1,replace=True)<br>    boot_mean_diff.append(boot_after.mean()-boot_before.mean())</pre><pre># Calculating a 95% confidence interval from boot_mean_diff <br>confidence_interval = pd.Series(boot_mean_diff).quantile([0.025, 0.975])<br>confidence_interval</pre><pre><strong>#Our cofidence_interval values <br></strong>0.025   -0.101433<br>0.975   -0.067311</pre><p>So handwashing reduced the proportion of deaths by between 6.7 and 10 percentage points, according to our 95% confidence interval. It seems that Semmelweis had solid evidence that handwashing was a simple but highly effective procedure that saves many lives. Those lessons still ring loudly today, so be sure fellow readers to keep the handwash soap filled in the coming days, weeks and months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6be1ff7570fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data tips for journalists]]></title>
            <link>https://medium.com/@danielleodinicola/data-tips-for-journalists-95104ff89dce?source=rss-975f3a928eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/95104ff89dce</guid>
            <dc:creator><![CDATA[Daniel DiNicola]]></dc:creator>
            <pubDate>Wed, 18 Mar 2020 04:02:38 GMT</pubDate>
            <atom:updated>2020-03-18T04:02:38.005Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHa5e4A_REwPThr5krI9OA.jpeg" /></figure><h3>“A good newspaper, I suppose is a nation talking to itself.” — Arthur Miller</h3><p>Newsrooms and media companies alike compete with each other for ratings and readers every day along with taking on the ever-expanding information highway for viewership. The collective audience is merely one click away from something else, something different, and something that isn’t your content.</p><p>Big data makes it possible for media companies to understand their audience in ways that would have made the newspaper editors of yesteryear blush. Metrics for which to evaluate an audience are seemingly infinite.</p><p>The newsrooms that are most effective at leveraging those metrics are the ones that assist their journalists in understanding what metrics they can control and how. Pausing and assessing metrics should not act as a report card on journalists, instead, these moments should be used to understand if focusing on a particular metric affects the bottom line.</p><p>During my time as a data scientist student, I came across Crowdtangle, an API that produces data from the social media pages of newsrooms and media companies. Unfortunately, a lowly want to be data journalist doesn’t yet have the backing of a newsroom, and I could not purchase the full Crowdtangle package.</p><p>The data provided from scraping a page allows for easy cross-examination with a competitor on how many likes, comments, and retweets a post may have gotten. The full package of Crowdtangle will break down Facebook comments to the range of emojis received, again providing a basis to compare against others in the market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*wcN5zSbVtAXSBBk8qdfjCw.png" /><figcaption>The basic package for CrowdTangle will only provide certain metrics.</figcaption></figure><p><strong>Search Engine Optimization as an antidote to writer’s block:</strong></p><p>“Writer’s block is only a failure of the ego” — Norman Mailer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HG_7COautnN6SMzZysj03w.jpeg" /><figcaption>We’ve all been there.</figcaption></figure><p>That horrid sight — the cursor blinking back at you. Each half second, it asks the same question again; why aren’t you writing?</p><p>You think a bit harder, place that paw on your forehead, edge closer to the blue light screen, start to rub your cranium, subconsciously hoping that the genie will appear with three perfect phrases to attach those ideas together. Your heart is now beating either too much or too little, and you can’t tell the difference.</p><p>But it still keeps blinking. Blink …. blink …. not one word has been placed. Blink …. blink …. “<em>what is my editor going to think?</em>” Blink … blink … <em>“maybe it’s time to get the Starbucks apron from the dresser?”</em></p><p>Do not worry fellow scribblers. I welcome you, we all welcome you and issue a congratulation as you’ve passed the frontier from the land of the cognitively stable to the land of the mental malady known as writer’s block.</p><p>Truth be told, it’s part of the racket you’ve chosen. Humans aren’t designed to understand, produce, and explain ideas as fast we can consume them. So how can data help us overcome this seemingly ubiquitous torment?</p><p>It’s simple and rather comic, ask google? No, no, no, don’t go into the search engine and ask it what to write. Use its databases to see what your audience is already curious about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*ee4DMU1Jr0L34Do_-Lw0-A.png" /><figcaption>What do you think you’re readers are concerned about?</figcaption></figure><p>This quick snapshot is broken down by congressional district and confirms that interest in the subject of health care is the first issue of concern for your readers. Now it’s time to refresh yourself with the state budget and let your readers know down to the last cent just how much their state government is spending to assure the health of its citizens.</p><p>So maybe this table is able to alleviate some of that stress in terms of what my readers are concerned about, but what about that the never-ending news cycle? Don’t I need to cover what’s happening today? You do, but use a simple data frame manipulation to inquire if any of your readers have been intrigued by the topic.</p><p>Google trends, which is where our data here comes from, offers this sort of information at fingertips length and is a great starting off point for any general assignment journalist not dedicated to a beat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95104ff89dce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>