This repository has been archived by the owner. It is now read-only.
⛔️[SUSPENDED] An R parser for ArchieML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
inst/archieml-js
man
tests
.Rbuildignore
.gitignore
.gitmodules
.travis.yml
DESCRIPTION
LICENSE
NAMESPACE
README.Rmd
README.md
appveyor.yml
example_tests.md

README.md

Project Status: Suspended – Initial development has started, but there has not yet been a stable, usable release; work has been stopped for the time being but the author(s) intend on resuming work. Build Status AppVeyor Build Status codecov.io

An R parser for ArchieML

This package is a wrapper for archieml-js, a parser for the New York Times' ArchieML format. ArchieML is designed to include structured data in free-form documents.

Right now it just has one function, from_archie, which loads ArchieML data from a string, file, or URL.

archieml-js (included under inst, using git subtree) parses ArchieML to JSON. It is run using V8, and then the JSON data is imported via jsonlite.

Install

Note that, because it uses the V8 package, rchie has a system requirement of libv8.

library(devtools)
install_github('ropensci/rchie')

Usage

from_archie can read ArchieML from a string, file, or URL:

library(rchie)
data1 = "
  [arrayName]
  
  Jeremy spoke with her on Friday, follow-up scheduled for next week
  name: Amanda
  age: 26
  
  # Contact: 434-555-1234
  name: Tessa
  age: 30
  
  []
  "

from_archie(data1)          
#> $arrayName
#>     name age
#> 1 Amanda  26
#> 2  Tessa  30
from_archie('http://archieml.org/test/1.0/arrays.1.aml')
#> No encoding supplied: defaulting to UTF-8.
#> $test
#> [1] "[array] creates an empty array at array"
#> 
#> $result
#> [1] "{\"array\": []}"
#> 
#> $array
#> list()

Note that you can pass arguments through from_archie to jsonlite::fromJSON to determine how JSON is converted to R objects:

from_archie(data1, simplifyVector=FALSE)
#> $arrayName
#> $arrayName[[1]]
#> $arrayName[[1]]$name
#> [1] "Amanda"
#> 
#> $arrayName[[1]]$age
#> [1] "26"
#> 
#> 
#> $arrayName[[2]]
#> $arrayName[[2]]$name
#> [1] "Tessa"
#> 
#> $arrayName[[2]]$age
#> [1] "30"

See http://archieml.org/ for more examples of ArchieML

ropensci_footer