IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Supply Chain Analysis with R Using the planr Package

    Business Science发表于 2024-10-20 07:00:00
    love 0
    [This article was first published on business-science.io, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

    Hey guys, welcome back to my R-tips newsletter. Supply chain management is essential in making sure that your company’s business runs smoothly. One of the key elements is managing inventory efficiently. Today, I’m going to show you how to estimate inventory and forecast inventory levels using the planr package in R. Let’s dive in!

    Table of Contents

    Here’s what you’ll learn in this article:

    • Why Inventory Projections Are Crucial to Supply Chain Management
    • How to Use the planr Package to Project Inventories
      • Loading Supply Chain Data
      • Projecting Inventory Levels
      • Visualizing Demand Over Time
      • Creating Interactive Tables for Projected Inventories
    • Before You Go Any Further: Join the R-Tips Newsletter to get the Data and Code so you can follow along

    Supply Chain Analysis with R Using the planr Package

    Get the Code (In the R-Tip 084 Folder)


    SPECIAL ANNOUNCEMENT: ChatGPT for Data Scientists Workshop on October 23rd

    Inside the workshop I’ll share how I built a Machine Learning Powered Production Shiny App with ChatGPT (extends this data analysis to an insane production app):

    ChatGPT for Data Scientists

    What: ChatGPT for Data Scientists

    When: Wednesday October 23rd, 2pm EST

    How It Will Help You: Whether you are new to data science or are an expert, ChatGPT is changing the game. There’s a ton of hype. But how can ChatGPT actually help you become a better data scientist and help you stand out in your career? I’ll show you inside my free chatgpt for data scientists workshop.

    Price: Does Free sound good?

    How To Join: 👉 Register Here


    R-Tips Weekly

    This article is part of R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks. Pretty cool, right?

    Here is the link to get set up. 👇

    • Sign up for our R-Tips Newsletter and get the code.

    How to Project Inventories with the planr Package

    Why Inventory Projections Are Crucial to Supply Chain Management

    Supply chain management is all about balancing supply and demand to ensure that inventory levels are optimized. Overestimating demand leads to excess stock, while underestimating it causes shortages. Accurate inventory projections allow businesses to plan ahead, make data-driven decisions, and avoid costly errors like over-buying inventory or getting into a stock-outage and having no inventory to meet demand.

    Enter the planr Package

    The planr package simplifies inventory management by projecting future inventory levels based on supply, demand, and current stock levels.

    Planr Github

    Supply Chain Analysis with planr

    Let’s take a look at how to use planr to optimize your supply chain. We’ll go through a quick tutorial to get you started using planr to project and manage inventories.

    Step 1: Load Libraries and Data

    First, you need to install the required packages and load the libraries. Run this code:

    Libraries

    Data

    Get the Code (In the R-Tip 087 Folder)

    This data contains supply and demand information for various demand fulfillment units (DFUs) over a period of time.

    • Demand Fullfillment Unit (DFU): A product identifier, here labeled as “Item 000001” (there are 10 items total).
    • Period: Monthly periods corresponding to supply and demand.
    • Demand: Customers purchase and reduce on-hand inventory.
    • Opening: An initial inventory of 6570 units in the first period for Item 000001.
    • Supply: New supplies arriving in subsequent months.

    Step 2: Visualizing Demand Over Time

    The first step in understanding supply chain performance is visualizing demand trends. We can use timetk::plot_time_series() to get a clear view of the demand fluctuations. Run this code:

    timetk::plot_time_series() code

    Get the Code (In the R-Tip 087 Folder)

    This code will produce a set of time series plots that show how demand changes over time for each DFU. By visualizing these trends, you can identify patterns and outliers that may impact your projections.

    timetk plot time series plot

    Step 3: Projecting Inventory Levels

    Once you have a good understanding of demand, the next step is to project your future inventory levels. The planr::light_proj_inv() function helps you do this. Run this code:

    Light Inventory Projection

    Get the Code (In the R-Tip 087 Folder)

    This function takes in the DFU, Period, Demand, Opening stock, and Supply as inputs to project inventory levels over time by item. The output is a data frame that contains the projected inventories for each period and DFU.

    Step 4: Creating an Interactive Table for Projected Inventories

    To make your projections more interactive and accessible, you can create an interactive table using reactable and reactablefmtr. I’ve made a function to automate the process for you based on the planr’s awesome documentation. Run this code:

    Interactive Table Code

    Projected Inventory Table

    Get the Code (In the R-Tip 087 Folder)

    This generates a beautiful interactive table where you can filter and sort the projected inventories. Interactive tables make it easier to analyze your data and share insights with your team.

    Conclusion

    By using the planr package, you can project inventory levels with ease, helping you manage your supply chain more effectively. This leads to better decision-making, reduced stockouts, and lower carrying costs.

    But there’s more to mastering supply chain analysis in R.

    If you would like to grow your Business Data Science skills with R, then please read on…

    Need to advance your business data science skills?

    I’ve helped 6,107+ students learn data science for business from an elite business consultant’s perspective.

    I’ve worked with Fortune 500 companies like S&P Global, Apple, MRM McCann, and more.

    And I built a training program that gets my students life-changing data science careers (don’t believe me? see my testimonials here):

    6-Figure Data Science Job at CVS Health ($125K)
    Senior VP Of Analytics At JP Morgan ($200K)
    50%+ Raises & Promotions ($150K)
    Lead Data Scientist at Northwestern Mutual ($175K)
    2X-ed Salary (From $60K to $120K)
    2 Competing ML Job Offers ($150K)
    Promotion to Lead Data Scientist ($175K)
    Data Scientist Job at Verizon ($125K+)
    Data Scientist Job at CitiBank ($100K + Bonus)

    Whenever you are ready, here’s the system they are taking:

    Here’s the system that has gotten aspiring data scientists, career transitioners, and life long learners data science jobs and promotions…

    What They're Doing - 5 Course R-Track

    Join My 5-Course R-Track Program Now!
    (And Become The Data Scientist You Were Meant To Be…)

    P.S. – Samantha landed her NEW Data Science R Developer job at CVS Health (Fortune 500). This could be you.

    Success Samantha Got The Job

    To leave a comment for the author, please follow the link and comment on their blog: business-science.io.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Continue reading: Supply Chain Analysis with R Using the planr Package


沪ICP备19023445号-2号
友情链接