https://github.com/gorpipe/gorpiper
R library for running GOR commands locally from R
https://github.com/gorpipe/gorpiper
Last synced: about 1 month ago
JSON representation
R library for running GOR commands locally from R
- Host: GitHub
- URL: https://github.com/gorpipe/gorpiper
- Owner: gorpipe
- License: other
- Created: 2022-05-02T15:12:32.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-23T09:41:34.000Z (about 4 years ago)
- Last Synced: 2026-05-27T03:34:29.128Z (about 1 month ago)
- Language: R
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

The Gorpiper R package enables users to run GOR queries locally.
See full documentation at [https://gorpipe.github.io/gorpiper/](https://gorpipe.github.io/gorpiper/) and the open-source [GORpipe](https://gorpipe.org) official website.
## Getting started
### Prerequisites
To be able to run GOR queries locally using `gorpiper` you will need to start by downloading and setting GOR up locally. See [GOR-project's](https://gorpipe.org/blog/getting-started-with-gor) setup instructions.
### Installing Gorpiper from CRAN
Once GOR has been setup successfully you can install Gorpiper from CRAN
``` r
install.packages("gorpiper")
```
## Example
In this example we will cover how to run a simple GOR query locally using the `gorpiper` package.
### Load package
Begin by loading the `gorpiper` package
``` r
# install.packages('gorpiper')
require(gorpiper)
```
### Set path to gorpipe's binary file
For ease of use we recommend adding gorpipe to path. If gorpipe has been added to path we can access the path to gorpipe's binary file using
``` r
gorpipe_path <- Sys.which("gorpipe")
```
else, we need to set it manually in the following manner
``` r
gorpipe_path <- "~/gorscripts-dist/bin/gorpipe>"
```
We create a gorpipe object by passing the path to the gorpipe binary, to the `get_gorpipe` method.
Now we are ready to successfully execute our GOR queries.
Below is an example of a query that creates test data, column rownum with values from 0 to 21. Then we calculate two columns, an integer division column called `even` and then ??`even_str` that gives "yes" for all instances where the value of even is exactly 1 and "no" otherwise.
``` r
gorpipe <- get_gorpipe(porpipe_path)
gorpipe("norrows 21 | calc even mod(rownum, 2) | calc even_str if(even==1,'yes','no')")
```
Now you should be all set to start using the gorpiper package, Happy GORing!