Skip to contents

Returns the URL for the image based on folder_path and name

Usage

get_emw_image(folder_path, img_name)

Arguments

folder_path

Names of addition path required to locate items within runza folder after https://emmarshall.github.io/runza/img/...

img_name

Name of column to locate individual item within folder

Value

Character vector of URLs

Examples

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
## Need to set folder path correctly each time
fitz_data <- tibble(
  id = 1:4,
  scene = c("baby", "park", "play", "silly"),
  x_pos = c(1, 2, 1, 2),
  y_pos = c(1, 1, 2, 2)
)
#'
# Add image paths to the dataset
fitz_data_with_images <- fitz_data |>
  mutate(
    image_path = get_emw_image("fitz/", scene)
  )

# Display the resulting data frame
print(fitz_data_with_images)
#> # A tibble: 4 × 5
#>      id scene x_pos y_pos image_path                                           
#>   <int> <chr> <dbl> <dbl> <glue>                                               
#> 1     1 baby      1     1 https://emmarshall.github.io/runza/img/fitz/baby.png 
#> 2     2 park      2     1 https://emmarshall.github.io/runza/img/fitz/park.png 
#> 3     3 play      1     2 https://emmarshall.github.io/runza/img/fitz/play.png 
#> 4     4 silly     2     2 https://emmarshall.github.io/runza/img/fitz/silly.png