Skip to content

Commit 7df5b42

Browse files
committed
hotfix the examples in docs
1 parent e2cae3c commit 7df5b42

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

R/flowmapblue.R

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#' # example 1, normal flows
3232
#' # set your Mapbox access token
3333
#' Sys.setenv(MAPBOX_API_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN")
34-
#'
34+
#'
3535
#' # load locations and flows for Switzerland
3636
#' locations <- data(ch_locations)
3737
#' flows <- data(ch_flows)
@@ -44,71 +44,71 @@
4444
#' darkMode = TRUE,
4545
#' animation = FALSE
4646
#' )
47-
#'
47+
#'
4848
#' # view the map
4949
#' flowmap
50-
#'
50+
#'
5151
#' # or save it as an HTML file
5252
#' htmlwidgets::saveWidget(flowmap, file = "flowmap.html")
53-
#'
53+
#'
5454
#' # example 2, flows with date in time column
5555
#' # set your Mapbox access token
5656
#' Sys.setenv(MAPBOX_API_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN")
57-
#'
57+
#'
5858
#' # load locations and flows for Switzerland
59-
#' locations <- data(ch_locations)
60-
#' flows <- data(ch_flows)
61-
#'
59+
#' data(ch_locations)
60+
#' data(ch_flows)
61+
#'
6262
#' # generate fake datetime
6363
#' flows$time <- seq(from =as.POSIXct("2020-01-01"),
6464
#' to = as.POSIXct("2020-01-05"), length.out = nrow(flows))
6565
#'
6666
#' flowmap <- flowmapblue(
67-
#' locations,
68-
#' flows,
67+
#' ch_locations,
68+
#' ch_flows,
6969
#' mapboxAccessToken = Sys.getenv('MAPBOX_API_TOKEN'),
7070
#' clustering = TRUE,
7171
#' darkMode = TRUE,
7272
#' animation = FALSE
7373
#' )
74-
#'
74+
#'
7575
#' # view the map
7676
#' flowmap
77-
#'
77+
#'
7878
#' # example 3, flows with date in time column
7979
#' # set your Mapbox access token
8080
#' Sys.setenv(MAPBOX_API_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN")
81-
#'
81+
#'
8282
#' # load locations and flows for Switzerland
83-
#' locations <- data(ch_locations)
84-
#' flows <- data(ch_flows)
83+
#' data(ch_locations)
84+
#' data(ch_flows)
8585
#' # generate fake dates
8686
#' flows$time <- seq(from = as.Date("2020-01-01"),
8787
#' to = as.Date("2020-06-01"), length.out = nrow(flows))
8888
#'
8989
#' flowmap <- flowmapblue(
90-
#' locations,
91-
#' flows,
90+
#' ch_locations,
91+
#' ch_flows,
9292
#' mapboxAccessToken = Sys.getenv('MAPBOX_API_TOKEN'),
9393
#' clustering = TRUE,
9494
#' darkMode = TRUE,
9595
#' animation = FALSE
9696
#' )
97-
#'
97+
#'
9898
#' # view the map
9999
#' flowmap
100100
#' }
101101
#'
102102
#' @import htmlwidgets
103103
#' @export
104104
flowmapblue <- function(
105-
locations, flows,
105+
locations,
106+
flows,
106107
mapboxAccessToken = NULL,
107108
clustering = TRUE,
108109
animation = FALSE,
109110
darkMode = FALSE
110111
) {
111-
112112
# convert time columng to UNIX time in milliseconds
113113
if ("time" %in% colnames(flows)) {
114114
if (inherits(flows$time, "POSIXct")) {
@@ -149,7 +149,7 @@ flowmapblue <- function(
149149
#' applications and interactive Rmd documents.
150150
#'
151151
#' @param outputId output variable to read from.
152-
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
152+
#' @param width,height Must be a valid CSS unit (like \code{'100\%'},
153153
#' \code{'400px'}, \code{'auto'}) or a number, which will be coerced to a
154154
#' string and have \code{'px'} appended.
155155
#' @param expr An expression that generates a `flowmapblue` widget.
@@ -168,13 +168,21 @@ flowmapblue <- function(
168168
#' @name flowmapblue-shiny
169169
#'
170170
#' @export
171-
flowmapblueOutput <- function(outputId, width = '100%', height = '400px'){
172-
htmlwidgets::shinyWidgetOutput(outputId, 'flowmapblue', width, height, package = 'flowmapblue')
171+
flowmapblueOutput <- function(outputId, width = '100%', height = '400px') {
172+
htmlwidgets::shinyWidgetOutput(
173+
outputId,
174+
'flowmapblue',
175+
width,
176+
height,
177+
package = 'flowmapblue'
178+
)
173179
}
174180

175181
#' @rdname flowmapblue-shiny
176182
#' @export
177183
renderFlowmapblue <- function(expr, env = parent.frame(), quoted = FALSE) {
178-
if (!quoted) { expr <- substitute(expr) } # force quoted
184+
if (!quoted) {
185+
expr <- substitute(expr)
186+
} # force quoted
179187
htmlwidgets::shinyRenderWidget(expr, flowmapblueOutput, env, quoted = TRUE)
180188
}

man/flowmapblue.Rd

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)