A wrapper around dataset
and
an import function.
Usage
dataset_download(
Title,
Dimensions = NULL,
Measures = NULL,
Attributes = NULL,
Identifier = NULL,
url,
type = "csv",
...
)
dataset_download_csv(
url,
Title,
Dimensions = NULL,
Measures = NULL,
Attributes = NULL,
Identifier = NULL,
type = "csv",
destfile = NULL,
method = "auto",
quiet = TRUE,
mode = "wb",
cacheOK = TRUE
)
Arguments
- Title
dct:title, a name given to the resource.
datacite
allows the use of alternate titles, too. Seedataset_title
.- Dimensions
The name or column number of the dimensions within the dataset.
- Measures
The name or column number of the measures within the dataset.
- Attributes
The name or column number of the attributes within the dataset.
- Identifier
An unambiguous reference to the resource within a given context. Recommended practice is to identify the resource by means of a string conforming to an identification system. Examples include International Standard Book Number (ISBN), Digital Object Identifier (DOI), and Uniform Resource Name (URN). Select and identifier scheme from registered URI schemes maintained by IANA. More details: Guidelines for using resource identifiers in Dublin Core metadata and IEEE LOM. Similar to
Identifier
indatacite
. Seeidentifier
.- url
a
character
string (or longer vector e.g., for the"libcurl"
method) naming the URL of a resource to be downloaded.- type
A file type. Currently only
csv
is implemented that invokesutils::download.file
.- ...
allow additional arguments to be passed, unused.
- destfile
a character string (or vector, see the
url
argument) with the file path where the downloaded file is to be saved. Tilde-expansion is performed.- method
Method to be used for downloading files. Current download methods are
"internal"
,"wininet"
(Windows only)"libcurl"
,"wget"
and"curl"
, and there is a value"auto"
: see ‘Details’ and ‘Note’.The method can also be set through the option
"download.file.method"
: seeoptions()
.- quiet
If
TRUE
, suppress status messages (if any), and the progress bar.- mode
character. The mode with which to write the file. Useful values are
"w"
,"wb"
(binary),"a"
(append) and"ab"
. Not used for methods"wget"
and"curl"
. See also ‘Details’, notably about using"wb"
for Windows.- cacheOK
logical. Is a server-side cached value acceptable?
Value
A dataset
with the downloaded dataset.
Examples
# \donttest{
dest_file <- file.path(tempdir(), "iris.csv")
dataset_download(
url = "https://zenodo.org/record/7421899/files/iris.csv?download=1",
Dimensions = NULL,
Measures = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width" ),
Attributes = "Species",
Title = "Iris Dataset",
Publisher = "American Iris Society",
Identifier = "https://doi.org/10.1111/j.1469-1809.1936.tb02137.x",
destfile = dest_file
)
#> Iris Dataset [https://doi.org/10.1111/j.1469-1809.1936.tb02137.x]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5.0 3.6 1.4 0.2 setosa
#> 6 5.4 3.9 1.7 0.4 setosa
#> 7 4.6 3.4 1.4 0.3 setosa
#> 8 5.0 3.4 1.5 0.2 setosa
#> 9 4.4 2.9 1.4 0.2 setosa
#> 10 4.9 3.1 1.5 0.1 setosa
#>
#> ... 140 further observations.
#> Source:https://zenodo.org/record/7421899/files/iris.csv?download=1.
# }