Skip to content

Commit

Permalink
arrow.available
Browse files Browse the repository at this point in the history
  • Loading branch information
tdhock committed Aug 27, 2024
1 parent cacc3d3 commit 77ed2bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vignettes/v7-capture-glob.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Below we read those files into R, using the following syntax:
* the other arguments form a regular expression pattern:
* The named argument `Species` matches that part of the file name,
and is captured to the resulting column of the same name,
* the un-name argument `"[.]csv"` indicates that suffix must be matched (but since the argument is not named, it is not captured, nor saved as a column in the output).
* the un-named argument `"[.]csv"` indicates that suffix must be matched (but since the argument is not named, it is not captured, nor saved as a column in the output).

```{r}
nc::capture_first_glob(iglob, Species="[^/]+", "[.]csv")
Expand Down Expand Up @@ -147,7 +147,8 @@ In the code below, we write the same data to a set of CSV files with
different names,

```{r}
if(requireNamespace("arrow") && arrow::arrow_with_dataset()){
arrow.available <- requireNamespace("arrow") && arrow::arrow_with_dataset()
if(arrow.available){
path <- tempfile()
arrow::write_dataset(
dataset=data.chunk.dt,
Expand All @@ -165,7 +166,7 @@ with three variables encoded in the file path (data, chunk, part).
The code below reads one of the files back into R:

```{r}
if(requireNamespace("arrow")){
if(arrow.available){
data.table::fread(hive.files[1])
}
```
Expand All @@ -174,7 +175,7 @@ The output above indicates that the file only has four columns (and is missing t
In the code below, we read all those files back into R:

```{r}
if(requireNamespace("arrow")){
if(arrow.available){
hive.pattern <- list(
nc::field("data","=",".*?"),
"/",
Expand Down

0 comments on commit 77ed2bb

Please sign in to comment.