library(arrow)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()` for more information.
#>
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#>
#> timestamp
library(dplyr)
#>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ellmer) | |
| kendrick_wiki_text <- "Kendrick Lamar Duckworth (born June 17, 1987) is an American rapper, singer, songwriter, and record producer. Regarded as one of the greatest rappers of all time, he was awarded the 2018 Pulitzer Prize for Music, becoming the first musician outside of the classical and jazz genres to receive the award. Lamar's music, rooted in West Coast hip-hop, features conscious, introspective lyrics, with political criticism and social commentary concerning African-American culture." | |
| hip_hop_theme <- type_enum(c("conscious_rap", "party_anthems", "storytelling", "braggadocio", "love_relationships")) | |
| artist_type <- type_object( | |
| name = type_string("Artist's full name"), | |
| birth_date = type_string("Birth date in YYYY-MM-DD format"), | |
| genre = type_string("Primary music genre"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ellmer) | |
| kendrick_wiki_text <- "Kendrick Lamar Duckworth (born June 17, 1987) is an American rapper, singer, songwriter, and record producer. Regarded as one of the greatest rappers of all time, he was awarded the 2018 Pulitzer Prize for Music, becoming the first musician outside of the classical and jazz genres to receive the award. Lamar's music, rooted in West Coast hip-hop, features conscious, introspective lyrics, with political criticism and social commentary concerning African-American culture." | |
| artist_type <- type_object( | |
| name = type_string("Artist's full name"), | |
| birth_date = type_string("Birth date in YYYY-MM-DD format"), | |
| genre = type_string("Primary music genre"), | |
| themes = type_array(type_string("Musical themes")) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo <- function() { | |
| time_limit <- 3 | |
| setTimeLimit(cpu = time_limit, elapsed = time_limit, transient = TRUE) | |
| on.exit({ | |
| setTimeLimit(cpu = Inf, elapsed = Inf, transient = FALSE) | |
| }) | |
| tryCatch({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Detect invalid timezones | |
| all_names <- tzdb::tzdb_names() | |
| bad_names <- c( | |
| all_names[startsWith(all_names, "US/")], | |
| all_names[!stringr::str_detect(all_names, "/")] | |
| ) | |
| all_names[map_lgl(all_names, ~!.x %in% bad_names)] |
library(arrow)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()` for more information.
#>
#> Attaching package: 'arrow'
#> The following object is masked from 'package:utils':
#>
#> timestamp
library(dplyr)
#>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` r | |
| library(arrow) | |
| library(dplyr) | |
| library(stringr) | |
| tf <- tempfile() | |
| # values to save - note the space after the final new line | |
| dodgy_vals <- "x,y\n0,1\n ,4" | |
| cat(dodgy_vals) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # query details copied from https://github.com/voltrondata-labs/arrowbench/blob/main/R/tpch-queries.R | |
| query_results <- lineitem_db %>% | |
| select(l_shipdate, l_returnflag, l_linestatus, l_quantity, | |
| l_extendedprice, l_discount, l_tax) %>% | |
| # kludge, should be: filter(l_shipdate <= "1998-12-01" - interval x day) %>% | |
| # where x is between 60 and 120, 90 is the only one that will validate. | |
| filter(l_shipdate <= as.Date("1998-09-02")) %>% | |
| select(l_returnflag, l_linestatus, l_quantity, l_extendedprice, l_discount, l_tax) %>% | |
| group_by(l_returnflag, l_linestatus) %>% | |
| summarise( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Apache Arrow R Questions on Stack Overflow" | |
| format: html | |
| --- | |
| ```{r} | |
| #| label: load-packages-and-code | |
| #| include: false | |
| library(httr) | |
| library(dplyr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| SOURCE_DIR='<path_to_project_root_goes_here>' | |
| # Find all .R files which have been staged via git add | |
| FILES_TO_STYLE=$(git diff --name-only --staged | grep "\.R") | |
| for FILE in ${FILES_TO_STYLE[@]} | |
| do |
NewerOlder