Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-5505: [R] namespace cleanup #4491

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions r/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ clang_format.sh
^_pkgdown\.yml$
^docs$
^pkgdown$
^.*\.orig$
4 changes: 2 additions & 2 deletions r/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ Imports:
assertthat,
glue,
R6,
vctrs (>= 0.1.0),
fs,
tibble,
crayon,
bit64
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
Suggests:
covr,
crayon,
pkgdown,
rmarkdown,
roxygen2,
testthat,
lubridate,
vctrs (>= 0.1.0),
hms
Collate:
'enums.R'
Expand Down
6 changes: 3 additions & 3 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export(RecordBatchStreamWriter)
export(StatusCode)
export(TimeUnit)
export(Type)
export(array)
export(arrow_array)
export(arrow_table)
export(arrow_available)
export(as_tibble)
export(boolean)
Expand Down Expand Up @@ -147,7 +148,6 @@ export(read_table)
export(record_batch)
export(schema)
export(struct)
export(table)
export(time32)
export(time64)
export(timestamp)
Expand All @@ -173,6 +173,6 @@ importFrom(rlang,"%||%")
importFrom(rlang,abort)
importFrom(rlang,dots_n)
importFrom(rlang,list2)
importFrom(rlang,warn)
importFrom(tibble,as_tibble)
importFrom(tibble,lst)
useDynLib(arrow, .registration = TRUE)
2 changes: 1 addition & 1 deletion r/R/ArrayData.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' @section Usage:
#'
#' ```
#' data <- array(x)$data()
#' data <- arrow_array(x)$data()
#'
#' data$type()
#' data$length()
Expand Down
7 changes: 6 additions & 1 deletion r/R/R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
self$`.:xp:.` <- xp
},
print = function(...){
cat(crayon::silver(glue::glue("{cl}", cl = class(self)[[1]])), "\n")
msg <- glue("{cl}", cl = class(self)[[1]])
if ("crayon" %in% rownames(installed.packages())) {
# Colorize it
msg <- crayon::silver(msg)
}
cat(msg, "\n")
if(!is.null(self$ToString)){
cat(self$ToString(), "\n")
}
Expand Down
9 changes: 5 additions & 4 deletions r/R/Table.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@
)
)

#' Create an arrow::Table from a data frame
#' Create an `arrow::Table` from a data frame
#'
#' @param ... arrays, chunked arrays, or R vectors
#' @param schema a schema. The default (`NULL`) infers the schema from the `...`
#'
#' @return an arrow::Table
#' @return an `arrow::Table`
#'
#' @export
table <- function(..., schema = NULL){
dots <- tibble::lst(...)
#' @importFrom tibble lst
arrow_table <- function(..., schema = NULL){
dots <- lst(...)
stopifnot(length(dots) > 0)
shared_ptr(`arrow::Table`, Table__from_dots(dots, schema))
}
Expand Down
10 changes: 5 additions & 5 deletions r/R/array.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#' @section Usage:
#'
#' ```
#' a <- array(x)
#' a <- arrow_array(x)
#'
#' a$IsNull(i)
#' a$IsValid(i)
Expand Down Expand Up @@ -120,11 +120,12 @@
#' create an [arrow::Array][arrow__Array] from an R vector
#'
#' @param x R object
#' @param type Explicit [type][arrow__DataType], or NULL (the default) to infer from the data
#' @param type Explicit [type][arrow__DataType], or NULL (the default) to infer
#' from the data
#' @return An Arrow array R6 object
#'
#' @importFrom rlang warn
#' @export
array <- function(x, type = NULL){
arrow_array <- function(x, type = NULL){
`arrow::Array`$dispatch(Array__from_vector(x, type))
}

Expand All @@ -134,4 +135,3 @@ array <- function(x, type = NULL){
dictionary = function() `arrow::Array`$dispatch(DictionaryArray__dictionary(self))
)
)

2 changes: 1 addition & 1 deletion r/R/write_arrow.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ to_arrow <- function(x) {

# splice the data frame as arguments of table()
# see ?rlang::list2()
`to_arrow.data.frame` <- function(x) table(!!!x)
`to_arrow.data.frame` <- function(x) arrow_table(!!!x)

#' serialize an [arrow::Table][arrow__Table], an [arrow::RecordBatch][arrow__RecordBatch], or a
#' data frame to either the streaming format or the binary file format
Expand Down
2 changes: 1 addition & 1 deletion r/data-raw/codegen.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cpp_functions_definitions <- decorations %>%
select(name, return_type, args, file, line) %>%
pmap_chr(function(name, return_type, args, file, line){
glue::glue('
// {basename(file)}:{line}
// {basename(file)}
#if defined(ARROW_R_WITH_ARROW)
{return_type} {name}({real_params});
RcppExport SEXP _arrow_{name}({sexp_params}){{
Expand Down
2 changes: 1 addition & 1 deletion r/man/arrow__Array.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion r/man/arrow__ArrayData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions r/man/array.Rd → r/man/arrow_array.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions r/man/table.Rd → r/man/arrow_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading