Skip to content

Commit 52db554

Browse files
committed
Make R examples within help runnable for CRAN (#734)
* remove \dontrun and use interactive() * ✏️ add single quotes for CRAN
1 parent a209108 commit 52db554

File tree

1 file changed

+68
-58
lines changed

1 file changed

+68
-58
lines changed

Diff for: packages/dash-table/dash-info.yaml

+68-58
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,88 @@
11
pkg_help_description: >-
22
An interactive table component designed for editing and exploring
3-
large datasets, DataTable is rendered with standard, semantic HTML
3+
large datasets, 'dashDataTable' is rendered with standard, semantic HTML
44
<table/> markup, which makes it accessible, responsive, and easy
5-
to style. This component was written from scratch in React.js
6-
specifically for the Dash community. Its API was designed to be
7-
ergonomic and its behaviour is completely customizable through its
5+
to style. This component was written from scratch in 'React.js'
6+
specifically for the 'Dash' community. Its API was designed to be
7+
ergonomic and its behaviour is completely customizable through its
88
properties.
99
pkg_help_title: >-
10-
Core Interactive Table Component for Dash
10+
Core Interactive Table Component for 'Dash'
11+
pkg_authors: >-
12+
c(person("Chris", "Parmer", email = "[email protected]", role = c("aut")), person("Ryan Patrick", "Kyle", email = "[email protected]", role = c("cre"), comment = c(ORCID = "0000-0002-4958-2844")), person(family = "Plotly Technologies, Inc.", role = "cph"))
13+
pkg_copyright: >-
14+
Plotly Technologies, Inc.
1115
r_examples:
12-
- name: dashDataTable
13-
dontrun: TRUE
16+
- name: dashDataTable
17+
dontrun: FALSE
1418
code: |
1519
# For comprehensive documentation of this package's features,
1620
# please consult https://dashr.plot.ly/datatable
1721
#
1822
# A package vignette is currently in development and will
1923
# provide many of the same examples currently available online
2024
# in an offline-friendly format.
21-
library(dash)
22-
library(dashTable)
2325
24-
app <- Dash$new()
26+
# The following if statement is not required to run this
27+
# example locally, but was added at the request of CRAN
28+
# maintainers.
29+
if (interactive()) {
30+
library(dash)
31+
library(dashTable)
2532
26-
# We can easily restrict the number of rows to display at
27-
# once by using style_table:
28-
app$layout(
29-
dashDataTable(
30-
id = "table",
31-
columns = lapply(colnames(iris),
32-
function(colName){
33-
list(
34-
id = colName,
35-
name = colName
36-
)
37-
}),
38-
style_table = list(
39-
maxHeight = "250px",
40-
overflowY = "scroll"
41-
),
42-
data = df_to_list(iris)
43-
)
44-
)
33+
app <- Dash$new()
4534
46-
app$run_server()
35+
# We can easily restrict the number of rows to display at
36+
# once by using style_table:
37+
app$layout(
38+
dashDataTable(
39+
id = "table",
40+
columns = lapply(colnames(iris),
41+
function(colName){
42+
list(
43+
id = colName,
44+
name = colName
45+
)
46+
}),
47+
style_table = list(
48+
maxHeight = "250px",
49+
overflowY = "scroll"
50+
),
51+
data = df_to_list(iris)
52+
)
53+
)
4754
48-
app <- Dash$new()
55+
app$run_server()
56+
57+
app <- Dash$new()
4958
50-
# We can also make rows and columns selectable/deletable
51-
# by setting a few additional attributes:
52-
app$layout(
53-
dashDataTable(
54-
id = "table",
55-
columns = lapply(colnames(iris),
56-
function(colName){
57-
list(
58-
id = colName,
59-
name = colName,
60-
deletable = TRUE
61-
)
62-
}),
63-
style_table = list(
64-
maxHeight = "250px",
65-
overflowY = "scroll"
66-
),
67-
data = df_to_list(iris),
68-
editable = TRUE,
69-
filter_action = "native",
70-
sort_action = "native",
71-
sort_mode = "multi",
72-
column_selectable = "single",
73-
row_selectable = "multi",
74-
row_deletable = TRUE
59+
# We can also make rows and columns selectable/deletable
60+
# by setting a few additional attributes:
61+
app$layout(
62+
dashDataTable(
63+
id = "table",
64+
columns = lapply(colnames(iris),
65+
function(colName){
66+
list(
67+
id = colName,
68+
name = colName,
69+
deletable = TRUE
70+
)
71+
}),
72+
style_table = list(
73+
maxHeight = "250px",
74+
overflowY = "scroll"
75+
),
76+
data = df_to_list(iris),
77+
editable = TRUE,
78+
filter_action = "native",
79+
sort_action = "native",
80+
sort_mode = "multi",
81+
column_selectable = "single",
82+
row_selectable = "multi",
83+
row_deletable = TRUE
84+
)
7585
)
76-
)
7786
78-
app$run_server()
87+
app$run_server()
88+
}

0 commit comments

Comments
 (0)