Type: Package
Title: Parse 'User-Agent' Strings
Version: 0.3.7
Date: 2026-04-01
Description: Despite there being a section in RFC 7231 https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.3 defining a suggested structure for 'User-Agent' headers this data is notoriously difficult to parse consistently. Tools are provided that will take in user agent strings and return structured R objects. This is a 'V8'-backed package based on the 'ua-parser' project https://github.com/ua-parser.
URL: https://github.com/gregfrog/uaparserjs
BugReports: https://github.com/gregfrog/uaparserjs/issues
License: Apache License 2.0 | file LICENSE
Suggests: tinytest, yaml
Depends: R (≥ 3.5.0)
Encoding: UTF-8
Imports: progress, V8
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2026-04-01 08:25:52 UTC; greg
Author: Bob Rudis [aut, cph], Greg Hunt [aut, cre, cph], Lindsey Simon [aut] (uap-core), Tobie Langel [aut] (uap-core), Colman Humphrey [ctb]
Maintainer: Greg Hunt <greg@firmansyah.com>
Repository: CRAN
Date/Publication: 2026-04-01 10:10:03 UTC

Parse 'User-Agent' Strings

Description

Despite there being a section in RFC 7231 <https://tools.ietf.org/html/rfc7231#section-5.5.3> defining a suggested structure for 'User-Agent' headers this data is notoriously difficult to parse consistently. Tools are provided that will take in user agent strings and return structured R objects. This is a 'V8'-backed package based on the 'ua-parser' project <https://github.com/ua-parser>.

Details

The package incorporates regular expressions and test data from the ua parser project that are copyrighted by Google and the UA Parser contributors and are used under an Apache 2 license. See the UA parser project for details.

Author(s)

Bob Rudis (@hrbrmstr)

See Also

Useful links:


Parse a vector of user agents into a data frame

Description

Takes in a character vector of user agent strings and returns a data frame classed as tibble. of parsed user agents.

Usage

ua_parse(user_agents, .progress = FALSE)

get_cache()

Arguments

user_agents

a character vector of user agents

.progress

if 'TRUE' will display a progress bar in interactive mode

Value

a data frame classed as tibble with columns for user agent family, major & minor versions plus patch level along with OS family and major & minor versions plus device brand and model.

Note

The regex YAML from uap-core is now updated when the package is rebuilt. The effective date can be found in the NEWS file.

References

<https://github.com/ua-parser/uap-core/>

Examples

ua_parse(paste0("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, ",
                "like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 ",
                "Chrome/15.0.874.106 Safari/535.2", collapse=""))

mirror server hosted at Truenetwork, Russian Federation.