<?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 Bryan Soong on Medium]]></title>
        <description><![CDATA[Stories by Bryan Soong on Medium]]></description>
        <link>https://medium.com/@kroneii?source=rss-d11faa47d43------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*LtJ7tqKC7fFU3dWn.jpg</url>
            <title>Stories by Bryan Soong on Medium</title>
            <link>https://medium.com/@kroneii?source=rss-d11faa47d43------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:52:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kroneii/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[Automate your Unit Testing on every Git Push]]></title>
            <link>https://medium.com/@kroneii/automate-your-unit-testing-on-every-git-push-41a9a3863503?source=rss-d11faa47d43------2</link>
            <guid isPermaLink="false">https://medium.com/p/41a9a3863503</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Bryan Soong]]></dc:creator>
            <pubDate>Thu, 24 May 2018 10:14:23 GMT</pubDate>
            <atom:updated>2018-05-24T10:14:23.918Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GbAMvkAT2T_DmUbC." /><figcaption>by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You built an app. You thought it was perfect. You’re wrong.</p><p>You revise an app again. You tested it and thought it was perfect. Again, you’re wrong.</p><p>Every time you revise your app, you have to re-test everything, you think that was stupid. So, you use <strong>Unit Testing</strong> to do these dirty jobs.</p><blockquote>Unit Testing is a set of codes that instruct computer to test the app on your behalf programmatically, so that you do not have to go through this repetitive tasks.</blockquote><p>Everything seems perfect now. Except that you have to <em>remember</em> to run unit testing each and every time you revise your app. How can we automate this?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*rvwUj5vvFEtZlcdpVsMKqQ.png" /><figcaption>Biztory CodePipeline to manage CI/CD workflow</figcaption></figure><p>We leverage on AWS CodePipeline to manage our CI/CD process, from git commit to deployment. In this article, we will explore how can we implement PHPUnit to be part of our workflow, so that only if the new revision passes the tests, it will flow down to next stage for deployment.</p><p>We are going to use AWS CodeBuild as a micro-service to run PHPUnit on the newly pushed revision. This is what we going to do here:</p><ol><li>Build a Docker image with PHPUnit installed</li><li>Upload the docker image to Amazon ECR</li><li>Create a CodeBuild project that runs the image</li><li>Link the CodeBuild project into our CodePipeline</li></ol><blockquote>My tutorial was referring to <a href="https://aws.amazon.com/blogs/devops/extending-aws-codebuild-with-custom-build-environments/">AWS DevOp article</a>, and personalized to our own need.</blockquote><h4>Bake a Docker Image with PHPUnit</h4><p>I actually write my DockerFile based on the sample given from AWS DevOp, and customized to PHP 5.6 and PHPUnit 4.3.5. I have also included MySQL and MCrypt in my build.</p><pre>FROM php:5.6-apache</pre><pre>ARG composer_checksum=55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30<br>ARG composer_url=https://raw.githubusercontent.com/composer/getcomposer.org/ba0141a67b9bd1733409b71c28973f7901db201d/web/installer</pre><pre>ENV COMPOSER_ALLOW_SUPERUSER=1<br>ENV PATH=$PATH:vendor/bin</pre><pre>RUN apt-get update &amp;&amp; apt-get install -y — no-install-recommends \<br> curl \<br> git \<br> python-dev \<br> python-pip \<br> zlib1g-dev \<br> libmcrypt-dev \<br> wget \<br> &amp;&amp; pip install awscli \<br> &amp;&amp; docker-php-ext-install zip mcrypt pdo pdo_mysql \<br> &amp;&amp; curl -o installer “$composer_url” \<br> &amp;&amp; echo “$composer_checksum *installer” | shasum -c -a 384 \<br> &amp;&amp; php installer — install-dir=/usr/local/bin — filename=composer \<br> &amp;&amp; rm -rf /var/lib/apt/lists/* \<br> &amp;&amp; wget https://phar.phpunit.de/phpunit-4.3.5.phar \<br> &amp;&amp; chmod +x phpunit-4.3.5.phar \<br> &amp;&amp; mv phpunit-4.3.5.phar /usr/local/bin/phpunit</pre><p>Next, build your Docker.</p><pre>docker build -t php5.6-phpunit .</pre><blockquote>It seems pretty straightforward, right? But this is the most killing part, I spent more than 4 hours understanding about Docker, test if PHPUnit is installed correctly, and if it actually works in my container. I may share more on this in another article, maybe one day.</blockquote><h4>A new home for your new docker image</h4><p>Now, you have to host your Docker image on Amazon ECR so that you can link it into CodeBuild later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUzbrInmzJztrYWgMi386w.png" /><figcaption>Amazon ECR to create your own Docker image repository</figcaption></figure><p>After you created the repo, simply follow the instruction given to push it over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*WI9tKe49Q3Z9Vo0dgqA3VA.png" /></figure><p>You should see your pushed image on the main tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f7dmdBRd3G13HzBatl1UNA.png" /></figure><p>Last but not least, grant the permission so that it allows CodeBuild to pull this image and setup the container later. Navigate to <strong>Permission </strong>tab and add a new policy, and allow ecr:GetDownloadUrlForLayer, ecr:BatchGetImage and ecr:BatchCheckLayerAvailability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*NsJwaKFpAPp7CRWGVTMWYQ.png" /></figure><h4>CodeBuild, the unsung micro-service-processor</h4><p>Let’s configure a new CodeBuild project to link with your docker image.</p><ul><li>Current source: choose where your git repo comes from. In my case, it’s AWS CodeCommit</li><li>Environment image: specify a Docker image and choose your image hosted on Amazon ECR</li><li>Build specification: if you have buildspec.yml in your codebase, go for <em>Use the buildspec.yml in the source code root directory</em>. I prefer to manage the build command in CodeBuild therefore I chose to insert custom command here.</li><li>Artifacts: No artifacts</li></ul><p>I left the rest untouched as default. As I have already run composer install in my codebase, I only instruct CodeBuild to run phpunit during testing phase.</p><pre>version: 0.1 <br>phases:   <br>  build:     <br>    commands:       <br>      - phpunit</pre><p>Voila! You are ready to test your codes using CodeBuild. You may head over to try run just to get a feel how it works on CodeBuild.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*th44tYdbsM-D41a6PxfYiQ.png" /><figcaption>CodeBuild returns as Failed where unit testing hit errors.</figcaption></figure><h4>Putting ’em together</h4><p>Lastly, simply slot in a build phase into your CodePipeline and point it to your fresh baked build project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODwBihW1vKgeJlPzIzEKdA.png" /></figure><p>Now, make a commit and push it, sit back and wait for it to flow through your pipeline.</p><blockquote>As lazy as me, i created a trigger to notify me on Slack in case the pipeline fails. Might write another article to share about this.</blockquote><p>Have something to say? Drop me a PM or comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41a9a3863503" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Diaper-Beer Relationship in Graph database]]></title>
            <link>https://medium.com/@kroneii/visualizing-diaper-beer-relationship-in-graph-database-e2790819ad13?source=rss-d11faa47d43------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2790819ad13</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[big-data-analytics]]></category>
            <dc:creator><![CDATA[Bryan Soong]]></dc:creator>
            <pubDate>Sun, 13 Dec 2015 11:44:34 GMT</pubDate>
            <atom:updated>2015-12-13T11:44:34.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*xgImNC5fR4oTj9I3ajbilQ.jpeg" /><figcaption>credit: <a href="https://bigdatabigworld.wordpress.com/tag/beer-and-nappies/">https://bigdatabigworld.wordpress.com/tag/beer-and-nappies/</a></figcaption></figure><blockquote>Wal-mart: People who bought diaper also buy beer. Therefore, they placed beer beside the diapers rack and it increased beers’ sales.</blockquote><p>My friend <a href="https://medium.com/u/a48f52863d15">Kelvin Lim</a> just wrote an introductory article about <a href="https://www.cheetooh.com/1-how-to-visualize-dataset-using-neo4j.html">using Neo4J to visualize categories map of iFlix.com movies</a>. Inspiring from that, I would like to see if I could explore some insights about buyer behavior from <a href="http://biztory.com.my/">Biztory</a> data using Neo4J.</p><blockquote>Biztory is a cloud based business management app that helps small business owner to manage their day-to-day business tasks from billing, inventory, customer, purchase to report and GST submissions, in a smart and simplified way.</blockquote><h4>Customer purchase history</h4><p>Biztory runs on <a href="http://laravel.com/">Laravel</a> and LAMP stack. Extracting the sales track records is just a matter of a few JOIN queries. Following Kelvin’s guide, I firstly need to export the data in CSV format.</p><p>Since I’m exploring the relationship between products sold in a single invoice, the nodes I need to create are:</p><ul><li><strong>(node) Product </strong>— the sold product item, consist of product name &amp; SKU (unique identifier)</li><li><strong>(relationship) Also_Bought</strong> — the relationship between Product A and Product B in the same invoice</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*YG4dbBoVEuxzgIRP6JM2Yw.png" /><figcaption>MySQL query to join the relationship between product A and product B sold in the same invoice</figcaption></figure><pre>USING PERIODIC COMMIT 1000<br>LOAD CSV WITH HEADERS FROM “file:/Users/bryan/Desktop/product-product-rel.csv”<br>AS csvline<br>WITH csvline<br>MERGE (p1:Product {sku: csvline.code1, name: csvline.name1})<br>MERGE (p2:Product {sku: csvline.code2, name: csvline.name2})<br>MERGE (p1)-[:Also_Bought{invoice:csvline.ref_num}]-(p2)</pre><pre>####<br>When you join the tables to see relationship between product A and B, you will get 2 relationships between the same products, A-&gt;B and B-&gt;A. In our case, what we concern is just A&lt;-&gt;B. Therefore, I run a MERGE statement when creating the relationship instead of CREATE to combine the duplicates.<br>####</pre><h4>Analyze it</h4><p>Say given a product “<em>KN-BM 3x5</em>”, I want to see what are the products that also being bought along.</p><pre>MATCH (p1:Product{sku:’KN-BM 3x5&#39;})<br>MATCH (p1)-[r:Also_Bought]-(p2:Product)<br>RETURN p1, p2, count(r) AS thickness</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*5gXyYgiO_QjeDmqGropSQg.png" /><figcaption>Graph visualization for products that also being bought when someone buy <strong>3x5&quot; BINTANG REBOND MATTRESS</strong> [<em>KN-BM 3x5</em>]</figcaption></figure><p>Given that, let’s see if we can strategize a good promo bundle package that can cross sell each other, and also trigger a chain sales.</p><h3>Marketing Idea</h3><h4>Scenario 1: Top selling product</h4><p>Applying the same query, below illustrates the network graph for one of the top selling product: <strong><em>Big Cotton Pillow</em></strong>.</p><p>The top part of the graph are mainly sponge mattress and reborn mattress (<em>mattress</em>). On the right side, are double decker and metal bed (<em>bed</em>). On the left and center part, bolster, blanket and bed sheet (<em>bedding accessories</em>). So far, these are related products for a pillow (<em>the diaper</em>).</p><p>Interesting, the bottom part of the graph shows a list of irrelevant products (<em>the beer</em>), such as kitchen stool, gas rack, plate rack, shoe cabinet and wardrobe.</p><p>From the finding, we can propose to bundle <strong>Big Cotton Pillow</strong> together with <strong>Single Bed Sheet</strong> and <strong>Blanket</strong>, and from the graph it is very likely it will lead to additional chain sales such as mattress and bed, or some kitchen stuffs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xi8DX9Ns_IAr-ttmXXJuyw.png" /><figcaption>Single bed sheet &amp; blanket have high correlations with pillow sales</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7gRRoqpWUvbz3E4iGJs-Sg.png" /><figcaption>list of related products of pillow sort by occurrence most at top</figcaption></figure><h4>Scenario 2: Low selling product with plenty of remaining stocks</h4><p>Another common problem is store owner may pile up some stocks but not selling well, and wish to do some clearance sales.</p><p>Graph below shows Japanese Coffee Table mostly sell along in two branches, either <em>Sofa</em> (right) or a bunch of inter-related products (<em>left</em>). Obviously, it is more potential to strategize along the left path as it gives us better chaining. We may hard to see this if we do not visualize it with a graph network and merely by looking at the excel spreadsheet.</p><p>In this case, I would propose to bundle with <em>2-Door Plastic Shoe Cabinet</em> as it has high linkage and it is also one of the popular product in the store. This bundle will give good money value to customers and at the same time helps the owner to clear the accumulating stock, hopefully it will also trigger some chain sales from there, or give some up-sell offer to boost the sales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*4ZhRNz1HCEA7EzlTUN8M2A.png" /><figcaption>graph shows the two main linked sales branches for Japanese Coffee Table</figcaption></figure><h3>Conclusion</h3><p>By applying big data analysis technique, it extends Biztory from an ordinary billing app to a smart business management app with some BI integrated within. It helps the business owner to have a better idea how to improve or resolve the business problem when diving into the insight of it.</p><blockquote>Having anything to share? Please leave your comment below :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2790819ad13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do I transform dataset from Excel spreadsheet using R?]]></title>
            <link>https://medium.com/@kroneii/how-do-i-transform-dataset-from-excel-spreadsheet-using-r-e5f5501e6d4d?source=rss-d11faa47d43------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5f5501e6d4d</guid>
            <category><![CDATA[r-programming]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Bryan Soong]]></dc:creator>
            <pubDate>Tue, 08 Dec 2015 11:06:54 GMT</pubDate>
            <atom:updated>2015-12-08T11:06:54.592Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, we were working on a group project in my Data Science Primer Course. A dataset scraped from iFlix.com is given in an Excel spreadsheet, tabbed with the category name in each sheet. My task is to transform all these sheets into a single master dataset and export as .csv file.</p><blockquote>We were later given a revised dataset in a master format and mapped with IMDB metadata, however the original iFlix category is removed. Therefore, I decided to re-process the dataset with iFlix category and merge with the revised version.</blockquote><p>While I’m well versed in PHP, I find it is tedious to process this using native PHP coding and I foresee there will be plenty of back-and-forth trial-and-error works, and who knows we might need to do some data cleaning or remove unnecessary columns along the way when we do data analysis at later stage.</p><p>I find R (<a href="https://www.r-project.org/about.html">read more about R</a>) just fit into this role perfectly because:</p><ul><li>I want something that can process &amp; manipulate the dataset easily</li><li>I can do some fundamental (or advanced) programming on the dataset</li><li>I can experiment the dataset and dump it if I find it irrelevant</li><li>I can export the resultant with ease</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlY_WKxqBaz9dQh2F-8aaQ.png" /><figcaption>iFlix.com, titles under category TV — Drama</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kTYYa4pOdVNicIcV6aVcw.png" /><figcaption>(iflix_contents.xlsx) Excel spreadsheet of the scraped data with title &amp; description and segregated with category on each sheet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcuas-uOtXkCXYETM6zbXw.png" /><figcaption>[iflix_contents_extra.xlsx] Excel spreadsheet of all iFlix titles mapped with IMDB metadata in single sheet, but original iFlix category is removed</figcaption></figure><h4>Step 1. Read the Excel spreadsheet</h4><p>First of all, we need to read the Excel into R environment. Note that the dataset has many tabs and named with the respective category name. After some googling and reading, I decided to use <em>readxl</em> method:</p><p><a href="http://stackoverflow.com/a/12945838">How to read all worksheets in an Excel Workbook into an R list with data.frame elements using XLConnect?</a></p><pre># install req lib<br>install.packages(“readxl”)<br>library(readxl)<br>library(plyr)<br># def fx<br>read_excel_allsheets &lt;- function(filename) {<br>  sheets &lt;- readxl::excel_sheets(filename)<br>  x &lt;- lapply(sheets, function(X) readxl::read_excel(filename, sheet = X))<br>  names(x) &lt;- sheets<br>  x<br>}<br># read excel<br>mysheets &lt;- read_excel_allsheets(“iflix_contents.xlsx”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*psp_AeYVyFUQrpt0xMU5iQ.png" /><figcaption>console output of mysheets</figcaption></figure><h4>Step 2. Load it into R data frame</h4><p>Now we already have the datasets of each sheet in a R data frame, we now want to shape it into following manner (column):</p><ul><li>title (string)</li><li>desc (string)</li><li>type (string = TV | Movie | Studio)</li><li>ctgy (string) : category of title stated in the sheet</li></ul><p>With my minimal knowledge of R and limited time, I just made a for loop to process it <em>(if you notice it is pretty much a PHP approach, share with me if there is a better way in doing this with R)</em></p><blockquote>Note: I skipped the first tab “information”, which something I don’t need</blockquote><pre># init the master df<br>df &lt;- data.frame(title = character(), desc = character(), type = character())<br># loop through the xls sheets<br>for (i in 1:length(mysheets)) {<br>  if (names(mysheets[i]) != ‘information’) {<br>    # if ctgy prefix with ‘TV — ‘, then type = ‘TV’; otherwise, ‘Movie’<br>    if (length(grep(‘Movie — ‘, names(mysheets[i]))) == 1) {<br>      mysheets[i][[1]]$type = ‘Movie’<br>      mysheets[i][[1]]$ctgy = sub(‘Movie — ‘, ‘’, names(mysheets[i]))<br>    } else if (length(grep(‘TV — ‘, names(mysheets[i]))) == 1) {<br>      mysheets[i][[1]]$type = ‘TV’;<br>      mysheets[i][[1]]$ctgy = sub(‘TV — ‘, ‘’, names(mysheets[i]))<br>    } else {<br>      mysheets[i][[1]]$type = ‘Studio’<br>      mysheets[i][[1]]$ctgy = names(mysheets[i])<br>    }<br> <br>    df &lt;- rbind(df, mysheets[i][[1]])<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*Cn-OI5k5DaLwVeYIO9owSQ.png" /><figcaption>preview of first transformed dataframe</figcaption></figure><p>This is how it looks like after consolidating 1995 rows of data.</p><h4>Step 3. Label the Top 200</h4><p>When you take a closer look at the data, you will see there are plenty of duplicates, either the same title falls under various category which is fine from database point of view, but it also duplicated into a category named “TV - Top 200” and “Movie - Top 200”. It makes more sense to create a new column on the data frame and number it accordingly.</p><p>We can do that using PHP, but doing it in R is surprisingly easier than I thought. What we need to do is extract the top 200 list and loop through it, and then remove all the rows categorized within that.</p><pre># def a df for top200 - filter $type == ‘TV — Top200’ from the master df<br>tvtop200 &lt;- df[df$type == ‘TV’ &amp; df$ctgy ==’Top 200&#39;,]</pre><pre># for loop the top200 &amp; assign them as top200<br>for (i in 1:nrow(tvtop200)) {<br> df$top200[df$title==tvtop200$title[i]] &lt;- i<br>}</pre><pre>mvtop200 &lt;- df[df$type == ‘Movie’ &amp; df$ctgy ==’Top 200&#39;,]<br># for loop the top200 &amp; assign them as top200<br>for (i in 1:nrow(mvtop200)) {<br> df$top200[df$title==mvtop200$title[i]] &lt;- i<br>}</pre><pre># remove rows where type == ‘Top 200’<br>df &lt;- subset(df, ctgy!=’Top 200&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*dLO_JNG0I_XER6UohLPIog.png" /><figcaption>preview of second transformed dataframe</figcaption></figure><h4>Step 4. Merge with IMDB Metadata</h4><p>Lastly, we read the IMDB mapped spreadsheet and merge it with our data frame. Again, it is done easily using R, with less codes!</p><pre># iflix_content_extra<br>iflix_xtra &lt;- read.csv(‘iflix_content_extra.csv’)<br>iflix_xtra &lt;- unique(iflix_xtra)<br># merge the data<br>df3 &lt;- merge(df, iflix_xtra, by.x = “title”, by.y = ‘Title_In_Iflix’)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc91J9wqpJdCykzZs0iTJA.png" /><figcaption>preview of final transformed dataframe</figcaption></figure><p>to export to csv:</p><pre>write.csv(df3, file=”iflix_bryan.csv”)</pre><p>You may now import the CSV to your data visualization tool such as <a href="http://www.tableau.com/">Tableau</a> or <a href="http://neo4j.com/">Neo4J</a> for further analysis.</p><h4>Bonus</h4><p>When you look into Genre column, you will notice it may contains more than one genre delimited with comma (,). So, if you would like to normalize this into several rows from database point of view, you may take the following snippet:</p><pre>df4 &lt;- df3<br>for (i in 1:nrow(df3)) {<br>  genre = strsplit(as.character(df3$Genre[i]), ‘, ‘)<br>  df4$Genre[i] = genre[[1]][1]<br>  if (length(genre[[1]]) &gt; 1) {<br>    for (j in 2:length(genre[[1]])) {<br>      df5 &lt;- df3[i,]<br>      df5$Genre &lt;- genre[[1]][j]<br>     df4 &lt;- rbind(df4, df5)<br>    }<br>  }<br>}</pre><p>Full Source file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb19eeca48716ff899ce1384a44cd33e/href">https://medium.com/media/cb19eeca48716ff899ce1384a44cd33e/href</a></iframe><blockquote>Anything to add? Do share with me in the comments :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5f5501e6d4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>