-
Notifications
You must be signed in to change notification settings - Fork 27
Description
I'm new to the dataverse package. I can't seem to get things working and I don't understand any of the errors.
The following functions are working:
get_dataverse('mydatversename')
contents <- dataverse_contents('mydataversename')
get_dataset(contents[[1]])
But adding datafiles to a newly created dataset fails (i'm following the examples given here https://www.rdocumentation.org/packages/dataverse/versions/0.3.0):
library(dataverse)
Sys.setenv("DATAVERSE_SERVER" = "demo.dataverse.nl")
Sys.setenv("DATAVERSE_KEY" = "myapitokenfromdataverse")
# retrieve your service document
d <- service_document()
# create a list of metadata
metadat <-
list(
title = "My Study3",
creator = "Doe, John",
description = "An example study"
)
# create the dataset
ds <- initiate_sword_dataset("mydataversename", body = metadat)
# add files to dataset
tmp <- tempfile()
write.csv(iris , file = tmp)
f <- add_file(ds, file = tmp)
The add_file() fails with the error:
Error in handle_url(handle, url, ...) :
Must specify at least one of url or handle
The following also does not work
f <- add_dataset_file(file = tmp, dataset = ds)
Error in parse_url(url) : length(url) == 1 is not TRUE
The other example at the previously mentioned link using the native API throws an error at the very first line and thus can't even create the dataset:
metadat <-
list(
title = "My Study4",
creator = "Doe, John",
description = "An example study"
)
ds <- create_dataset('mydataversename', body = metadat)
Error in create_dataset("mydataversename", body = metadat) :
Internal Server Error (HTTP 500).
Can anyone tell me why it is not working to add files? I'm not particularly adept at error handling, so if you need more info please instruct me on how to receive that info.
R version 4.03
Rstudio 1.4.1103
Windows 1909 build 18363.1256
demo.dataverse.nl v. 4.18.1
dataverse package v 0.3.0