Skip to content

Commit 90145b6

Browse files
committed
update to-dataframe example to use non-superceded tidyverse functions
1 parent 6b9cedd commit 90145b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+225
-75
lines changed

modules/openapi-generator/src/main/resources/r/modelGeneric.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@
218218
#' @examples
219219
#' # convert array of {{{classname}}} (x) to a data frame
220220
#' \dontrun{
221-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
221+
#' library(purrr)
222+
#' library(tibble)
223+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
222224
#' df
223225
#' }
224226
toList = function() {

samples/client/echo_api/r/R/bird.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ Bird <- R6::R6Class(
5555
#' @examples
5656
#' # convert array of Bird (x) to a data frame
5757
#' \dontrun{
58-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
58+
#' library(purrr)
59+
#' library(tibble)
60+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
5961
#' df
6062
#' }
6163
toList = function() {

samples/client/echo_api/r/R/category.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ Category <- R6::R6Class(
5555
#' @examples
5656
#' # convert array of Category (x) to a data frame
5757
#' \dontrun{
58-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
58+
#' library(purrr)
59+
#' library(tibble)
60+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
5961
#' df
6062
#' }
6163
toList = function() {

samples/client/echo_api/r/R/data_query.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ DataQuery <- R6::R6Class(
8282
#' @examples
8383
#' # convert array of DataQuery (x) to a data frame
8484
#' \dontrun{
85-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
85+
#' library(purrr)
86+
#' library(tibble)
87+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
8688
#' df
8789
#' }
8890
toList = function() {

samples/client/echo_api/r/R/default_value.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ DefaultValue <- R6::R6Class(
102102
#' @examples
103103
#' # convert array of DefaultValue (x) to a data frame
104104
#' \dontrun{
105-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
105+
#' library(purrr)
106+
#' library(tibble)
107+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
106108
#' df
107109
#' }
108110
toList = function() {

samples/client/echo_api/r/R/number_properties_only.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ NumberPropertiesOnly <- R6::R6Class(
6161
#' @examples
6262
#' # convert array of NumberPropertiesOnly (x) to a data frame
6363
#' \dontrun{
64-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
64+
#' library(purrr)
65+
#' library(tibble)
66+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
6567
#' df
6668
#' }
6769
toList = function() {

samples/client/echo_api/r/R/pet.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ Pet <- R6::R6Class(
9090
#' @examples
9191
#' # convert array of Pet (x) to a data frame
9292
#' \dontrun{
93-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
93+
#' library(purrr)
94+
#' library(tibble)
95+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
9496
#' df
9597
#' }
9698
toList = function() {

samples/client/echo_api/r/R/query.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Query <- R6::R6Class(
5454
#' @examples
5555
#' # convert array of Query (x) to a data frame
5656
#' \dontrun{
57-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
57+
#' library(purrr)
58+
#' library(tibble)
59+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
5860
#' df
5961
#' }
6062
toList = function() {

samples/client/echo_api/r/R/tag.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ Tag <- R6::R6Class(
5555
#' @examples
5656
#' # convert array of Tag (x) to a data frame
5757
#' \dontrun{
58-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
58+
#' library(purrr)
59+
#' library(tibble)
60+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
5961
#' df
6062
#' }
6163
toList = function() {

samples/client/echo_api/r/R/test_form_object_multipart_request_marker.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class(
4646
#' @examples
4747
#' # convert array of TestFormObjectMultipartRequestMarker (x) to a data frame
4848
#' \dontrun{
49-
#' df <- x |> purrr::map_dfr(\(y)y$toList())
49+
#' library(purrr)
50+
#' library(tibble)
51+
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
5052
#' df
5153
#' }
5254
toList = function() {

0 commit comments

Comments
 (0)