MyNixOS website logo
Description

Provides an Interface to the Department of Transportation VIN Decoder.

Provides a programmatic interface in R for the US Department of Transportation (DOT) National Highway Transportation Safety Administration (NHTSA) vehicle identification number (VIN) API, located at <https://vpic.nhtsa.dot.gov/api/>. The API can decode up to 50 vehicle identification numbers in one call, and provides manufacturer information about the vehicles, including make, model, model year, and gross vehicle weight rating (GVWR).

vindecodr vindecodr

CRAN statusbadge Travis buildstatus

The goal of vindecodr (pronounced “VIN decoder”) is to provide an efficient programmatic interface to the US Department of Transportation (DOT) National Highway Transportation Safety Administration (NHTSA) vehicle identification number (VIN) decoder API, located at https://vpic.nhtsa.dot.gov/api/.

Installation

You can install the released version of vindecodr from CRAN with:

install.packages("vindecodr")

Or you can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("burch-cm/vindecodr")

Loading

Load the library in R by calling library():

library(vindecodr)

Examples

Check the VIN for Errors:

VINs must be 17 digits long and cannot contain certain characters (I, O Q). In addition, vehicles sold in North America have a “check digit” in position 9 of the VIN. This check digit must equal the result of a calculation applied to the other VIN digits for the VIN to be considered valid.

{vindecodr} contains tools to validate the length, characters, and check digit of a given VIN or VINs, and to guess at any disallowed characters, which often creep into VIN records when recorded by hand.

The main function to check a number of VINs is check_vin(), which takes a character vector of VINs to check. If {purrr} is present, check_vin() will try to use it, otherwise a less-efficient loop will be used to iterate over the VINs.

vins <- c("WDBEA30D3HA391172", "3VWLL7AJ9BM053541")
check_vin(vins)
#> [1] TRUE TRUE

check_vin() looks at the length of the VINs, checks for disallowed characters (and attempts to correct them with guess = TRUE), and compares the result of the VIN check digit calculation with the digit in the check digit position of the VIN (the 9th position).

To check just the length and disallowed characters, use valid_vin_format()

valid_vin_format("WDBEA30D3HA391172")
#> [1] TRUE

To check the validity of the check digit, use valid_check_digit()

valid_check_digit("WDBEA30D3HA391172")
#> [1] TRUE

This can also return the check digit itself:

valid_check_digit("WDBEA30D3HA391172", value = TRUE)
#> [1] "3"

Find the Make and Model for a Given VIN:

Managed fleet vehicle systems often need to confirm the information they have on file for a particular vehicle, such as the make, model, fuel type, etc. This can easily be accomplished by comparing the records on file with the manufacturer’s values as encoded in the VIN.


given_vin <- "1C4BJWFGXDL531773"

vehicle_details <- decode_vin(given_vin)

knitr::kable(vehicle_details)
VINmakemodelmodel_yearfuel_typeGVWR
1C4BJWFGXDL531773JEEPWrangler2013GasolineClass 1D: 5,001 - 6,000 lb (2,268 - 2,722 kg)

Single VINs are passed to the Decode API Endpoint.
The same call can be used for up to 50 VINs. When multiple VINs are provided, the Batch API Endpoint is used instead.

library(vindecodr)

given_vins <- c("1C4BJWFGXDL531773",
                "JTHFF2C26B2515141",
                "WDBRF40J43F433102")

vehicle_details <- decode_vin(given_vins)
knitr::kable(vehicle_details[1:3])
VINmakemodel
1C4BJWFGXDL531773JEEPWrangler
JTHFF2C26B2515141LEXUSIS
WDBRF40J43F433102MERCEDES-BENZC-Class

See the NHTSA API Documentation for more detail on API endpoints.

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD 13
    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-freebsd13
  • 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-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows