knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Disclaimer: this package is still at an experimental level, and should only be used for testing, bug reports, and enhancement requests.

This package has only been tested on these platforms for now, with the files found in inst/examples, so it might not work on others :

rmd4j

The goal of {rmd4j} is to provide a knitr engine for running Neo4J inside an RMarkdown

Installation

You can install rmd4j from GitHub with:

# install.packages("remotes")
remotes::install_github("ThinkR-open/rmd4j")

Before using

You need to have downloaded the neo4j community edition, and have unpacked it.

In order to use this knitr engine, you must have a running connection to a Neo4J server, launched with $NEO4J_HOME/bin/neo4j start ($NEO4J_HOME being the folder you've unpacked neo4j into).

Note to Windows users: you might need to specify your path with \\, like C:\\USers\\colin\\Documents\\neo4j\\bin\\cypher-shell.bat.

Test the package

If you want to test the package before using, there are three .Rmd inside the inst/examples folder that can be use for playing with the package.

Add the path to you cypher bin, and test.

Any feedback is welcome!

Example

You can start a new document by take using the RMarkdown templates which come with the configuration chunk.

If you want to add a Neo4J engine to an existing Rmarkdown, add the set_neo4j_engine function inside the setup chunk in your RMarkdown.

If you follow the advices below about username and password, this should only be :

rmd4j::set_neo4j_engine(cypher_bin = "/Users/colin/soft/graphs/n4j/bin/cypher-shell")

Note: if you're a windows user, you need to specify the file extension (should be .bat)

But with more customisation:

rmd4j::set_neo4j_engine(cypher_bin = "/Users/colin/soft/graphs/n4j/bin/cypher-shell", 
                        neo4j_user = "colin", 
                        neo4j_passwd = "pouetpouet", 
                        neo4j_adress = "bolt://localhost:7687")

You can set:

As this chunk might contain some sensible information (like you password), don't forget to {r setup, include=FALSE} this chunk.

The chunks

Neo4J chunks should start with a ```{neo4j}.

You can run several Neo4J calls in the same chunk.

Please not that for now, comments are not supported (but we're working on it) https://github.com/ThinkR-open/rmd4j/issues/4

{rmd4j} comes with an addin to add a chunk.

About passwords and username

If you don't specify any neo4j_user and neo4j_passwd, set_neo4J_engine() will not use the --user and --password args of the cypher-shell. In that case, you'll need to have provided Neo4J your user name and password, or have disabled the password request (see below).

We strongly recommand to provide your Neo4J password outside of the rmd, as it will prevent any unwanted share of these credentials.

Disable Neo4J password request

Go to $NEO4J_HOME/conf/neo4j.conf and uncomment the line : dbms.security.auth_enabled=true

Create aliases (recommanded)

Add to your bash profile:

export NEO4J_USERNAME='yourusername'
export NEO4J_PASSWORD='yourpassword'

Via : Neo4J Knowledge base

Output

You can mix any other content (including R, of course), inside your Rmarkdown.

Example

Inside the package, you can find two examples in inst/examples.

Add the cypher bin path, and you're good to go.

Using github_document as output :

From Rmd to md.

Contact

Questions and feedbacks welcome!

You want to contribute ? Open a PR :) If you encounter a bug or want to suggest an enhancement, please open an issue.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



ThinkR-open/rmd4j documentation built on May 25, 2019, 1:35 p.m.