Skip to content

[R] arrow R package: support for stringr::str_replace_all() incomplete  #39191

@abfleishman

Description

@abfleishman

Describe the bug, including details regarding any error messages, version, and platform.

The arrow R package claims to support the stringr::str_replace_all() function, however, it does not support using a vector of pattern/replacements as the function says it should.

library(arrow)
#> 
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#> 
#>     timestamp
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(stringr)
dat<-data.frame(common_name=c("Cobalt-rumped Parrotlet", 
                              "Striped Woodcreeper", 
                              "Allard's Ground Cricket",
                              "Southern Double-collared Sunbird"))
dat_arrow<-arrow_table(dat)

# if working with a normal data.frame the following code works
dat_df<-dat %>% 
    mutate(common_name_clean = str_replace_all(common_name, c(" |-"="_", "'" = "")))

dat_df
#>                        common_name                common_name_clean
#> 1          Cobalt-rumped Parrotlet          Cobalt_rumped_Parrotlet
#> 2              Striped Woodcreeper              Striped_Woodcreeper
#> 3          Allard's Ground Cricket           Allards_Ground_Cricket
#> 4 Southern Double-collared Sunbird Southern_Double_collared_Sunbird

#but if working with an arrow data.frame it says I have to collect first
dat_arrow<-dat_arrow%>% 
    mutate(common_name_clean = str_replace_all(common_name, c(" |-"="_", "'" = "")))
#> Warning: Expression str_replace_all(common_name, c(` |-` = "_", `'` = "")) not
#> supported in Arrow; pulling data into R
Created on 2023-12-11 with reprex v2.0.2

Component(s)

R

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions