Description Usage Arguments Examples
Publish datapackage
1 |
dp |
Datapackage to be published |
python_path |
Path to python version |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # Importing libraries
library(dataverkr)
library(plotly)
# Creating dataframe
country <- c("Norge","Sverige", "Danmark")
numberOf <- c(200, 300, 500)
df <- data.frame(country, numberOf)
# Creating plotly figure
fig <- plot_ly(df, x = ~country, y = ~numberOf, type = 'bar')
fig
# Metadata for datapackage
metadata <- list(title = 'DataverkR example',
bucket = 'nav-opendata',
store = 'nais',
temporal = list(from = '2020-09-16',
to='2020-09-16'),
type = 'datapackage',
format ='datapackage')
# Creating datapackage
dp <- dataverkr::create_dp(metadata)
# Adding plotly figure to the datapackage
dataverkr::add_fig(dp = dp,
fig = fig,
title = 'Some plotly figure',
description = 'This is a plotly figure example')
# Adding dataframe as a resource to the datapackage
dataverkr::add_resource(dp = dp,
dataframe = df,
resource_name = 'some_dataframe',
resource_description = 'This is a resource example')
# Publishing the datapackage
dataverkr::publish(dp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.