publish: Publish datapackage

Description Usage Arguments Examples

View source: R/publish.R

Description

Publish datapackage

Usage

1
publish(dp, python_path = system("which python"))

Arguments

dp

Datapackage to be published

python_path

Path to python version

Examples

 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)

navikt/dataverkr documentation built on Dec. 22, 2021, 12:03 a.m.