Title: | Brown Dog R Interface |
---|---|
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. |
Authors: | Smruti Padhy, Rob Kooper, Yan Zhao |
Maintainer: | Yan Zhao <[email protected]> |
License: | FreeBSD | file LICENSE |
Version: | 0.2.1 |
Built: | 2024-10-31 06:23:00 UTC |
Source: | CRAN |
Convert a file using Brown Dog Conversion service
convert_file(url, input_file, output, output_path, token, wait = 60, download = TRUE)
convert_file(url, input_file, output, output_path, token, wait = 60, download = TRUE)
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 |
The output filename
## 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)
## 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)
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
download(url, file, token, timeout = 60)
download(url, file, token, timeout = 60)
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) |
the name of file if successfull or NA if not.
## 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)
## 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 content-based metadata from the given input file's content using Brown Dog extraction service
extract_file(url, file, token, wait = 60)
extract_file(url, file, token, wait = 60)
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 |
The extracted metadata in JSON format
## 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)
## 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 a key from the BD API gateway to access BD services
get_key(url, username, password)
get_key(url, username, password)
url |
URL of the BD API gateway |
username |
user name for BrownDog |
password |
password for BrownDog |
BD API key
## Not run: get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password") ## End(Not run)
## Not run: get_key("https://bd-api-dev.ncsa.illinois.edu", "your email", "password") ## End(Not run)
Check Brown Dog Service for available output formats for the given input format.
get_output_formats(url, inputformat, token)
get_output_formats(url, inputformat, token)
url |
The URL to the Brown Dog server to use. |
inputformat |
The format of the input file. |
token |
Brown Dog access token |
: A string array of reachable output format extensions.
## 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)
## 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 a Token from the BD API gateway to access BD services
get_token(url, key)
get_token(url, key)
url |
URL of the BD API gateway |
key |
permanet key for BD API |
BD API Token
## 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)
## 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)