MyNixOS website logo
Description

Request USDA MPR Historical Data via the 'LMR' API.

Interface to easily access data via the United States Department of Agriculture (USDA)'s Livestock Mandatory Reporting ('LMR') Data API at <https://mpr.datamart.ams.usda.gov/>. The downloaded data can be saved for later off-line use. Also provide relevant information and metadata for each of the input variables needed for sending the data inquiry.

usdampr: Request current and historical USDA-AMS MPR data

Background

In the 1990’s, concern over growing packer concentration and a hog industry market shock resulted in discontent among producers and packers. As a result, the US Congress passed the Livestock Mandatory Reporting Act of 1999 (1999 Act) Pub. L. 106-78, Title IX which is required to be reauthorized every 5 years. See here for a full history of the Livestock Mandatory Reporting Background. The Act requires U.S. Department of Agriculture (USDA) to create a livestock reporting system for up-to-date marketing information on cattle, swine, lambs, and the by-products of such livestock.

LMPRS requires packers, processors, and importers to report the marketing information several times each day, whereupon it is aggregated and made available electronically to these and other market participants. Since April 2000, market reports have been publicly issued in the form of .txt files with varying frequency. However, starting in April 2020, text files were made permanently unavailable. Instead, LMR began releasing report data on LMR Datamart, LMR Web Service and the LMR API in real time. This change brings both voluntary and mandatory report release processes in sync.

Usage description

The usdampr package provides access to the report data in LMPRS through R, and it is built on the LMR Web Service. Technically, all data available at the LMR Web Service can be accessed from the usdampr package.

mpr_request is the primary function in the usdampr package for making data requests. The data are automatically cleaned so that users can analyze and visualize the requested data without further data processing.

mpr_request takes two necessary inputs: slug ID and report time.

  • slug ID: Users can request data based on slug ID or the legacy slug ID. For example, users can request data from the report of "National Weekly Boxed Beef Cutout & Boxed Beef Cuts" by letting the slug ID be 2461 or the legacy slug ID be LM_XB459. Multiple slug ID can be used to request data from multiple reports at the same time.
  • report time: Users shall provide a report time for requesting the data.

The usdampr package also contains a data set called slugInfo, which documents some details about the reports (e.g., slug ID, legacy slug ID, report frequency, and report section headings). Please refer to the help page of the mpr_request function for details.

Examples

Below are some examples to show how the mpr_request function should be used.

Example 1: Request data for slug ID of 2461 on January 31, 2020

 test1a <- mpr_request(slugIDs = 2461, report_time = '01/31/2020')

Example 2: Request data for slug ID of 2461 and 2463 on January 31, 2020

test1c <- mpr_request(slugIDs = c(2461, 2463), report_time = '01/31/2020')

More examples are provided in the help page of the mpr_request function.

Package installation

For the latest version of the package, please install it from the GitHub using the codes below:

devtools::install_github('cbw1243/usdampr')

Note: You need to install the devtools package if you have not done it yet. Use install.packages('devtools').

You can also install the package via R directly:

install.packages('usdampr')

Authors & Contact

Bowen Chen, Email: [email protected]
Elliott J. Dennis, Email: [email protected].

Metadata

Version

1.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows