Type: | Package |
Title: | Brown Dog R Interface |
Version: | 0.2.1 |
Date: | 2017-10-06 |
Author: | Smruti Padhy, Rob Kooper, Yan Zhao |
Maintainer: | Yan Zhao <yanzhao3@illinois.edu> |
Description: | An R interface for the Brown Dog which allows researchers to leverage Brown Dog Services that provides modules to identify the conversion options for a file, to convert file to appropriate format, or to extract data from a file. See http://browndog.ncsa.illinois.edu/ for more information. |
Imports: | RCurl, jsonlite, httpuv, utils |
License: | FreeBSD | file LICENSE |
Copyright: | Authors |
LazyLoad: | yes |
LazyData: | FALSE |
RoxygenNote: | 5.0.1.9000 |
NeedsCompilation: | no |
Packaged: | 2017-10-06 16:19:14 UTC; yanzhao3 |
Repository: | CRAN |
Date/Publication: | 2017-10-06 16:24:16 UTC |
convert file
Description
Convert a file using Brown Dog Conversion service
Usage
convert_file(url, input_file, output, output_path, token, wait = 60,
download = TRUE)
Arguments
url |
The URL to the Brown Dog Server to use |
input_file |
The input file, either local file with path, or file url |
output |
The output format extension |
output_path |
The path for the created output file. May contain different filename. note the path ends with '/' |
token |
Brown Dog access token |
wait |
The amount of time to wait for the DAP service to respond. Default is 60 |
download |
The flag to download the result file. Default is true |
Value
The output filename
Examples
## Not run:
key <- get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
token <- get_token("https://bd-api-dev.ncsa.illinois.edu", key)
convert_file("https://bd-api-dev.ncsa.illinois.edu",
"http://browndog.ncsa.illinois.edu/examples/gi/Dongying_sample.csv", "xlsx", "/",
token)
## End(Not run)
Download file from browndog
Description
This will download a file, if a 404 is returned it will wait until the file is available. If the file is still not available after timeout tries, it will return NA. If the file is downloaded it will return the name of the file
Usage
download(url, file, token, timeout = 60)
Arguments
url |
the url of the file to download |
file |
the filename |
token |
Brown Dog access token |
timeout |
timeout number of seconds to wait for file (default 60) |
Value
the name of file if successfull or NA if not.
Examples
## Not run:
key <- get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
token <- get_token("https://bd-api-dev.ncsa.illinois.edu", key)
download("https://bd-api-dev.ncsa.illinois.edu", "vdc.csv", token)
## End(Not run)
Extract file
Description
Extract content-based metadata from the given input file's content using Brown Dog extraction service
Usage
extract_file(url, file, token, wait = 60)
Arguments
url |
The URL to the Brown Dog server to use. |
file |
The input file could be URL or file with the path |
token |
Brown Dog access token |
wait |
The amount of time to wait for the DTS to respond. Default is 60 seconds |
Value
The extracted metadata in JSON format
Examples
## Not run:
key <- get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
token <- get_token("https://bd-api-dev.ncsa.illinois.edu", key)
extract_file("https://bd-api-dev.ncsa.illinois.edu",
"http://browndog.ncsa.illinois.edu/examples/gi/Dongying_sample.csv", token)
## End(Not run)
Get Key
Description
Get a key from the BD API gateway to access BD services
Usage
get_key(url, username, password)
Arguments
url |
URL of the BD API gateway |
username |
user name for BrownDog |
password |
password for BrownDog |
Value
BD API key
Examples
## Not run:
get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
## End(Not run)
Get input format.
Description
Check Brown Dog Service for available output formats for the given input format.
Usage
get_output_formats(url, inputformat, token)
Arguments
url |
The URL to the Brown Dog server to use. |
inputformat |
The format of the input file. |
token |
Brown Dog access token |
Value
: A string array of reachable output format extensions.
Examples
## Not run:
key <- get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
token <- get_token("https://bd-api-dev.ncsa.illinois.edu", key)
get_output_formats("https://bd-api-dev.ncsa.illinois.edu", "csv",
token)
## End(Not run)
Get Token
Description
Get a Token from the BD API gateway to access BD services
Usage
get_token(url, key)
Arguments
url |
URL of the BD API gateway |
key |
permanet key for BD API |
Value
BD API Token
Examples
## Not run:
key <- get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password")
get_token("https://bd-api-dev.ncsa.illinois.edu", key)
## End(Not run)