EcologyR / labeleR

Package to create your own labels, certificates, and much more! :)

Home Page:https://ecologyr.github.io/labeleR/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create_badge gives error when affiliation.column not provided

Pakillo opened this issue · comments

Should affiliation.column be required? Currently gives error if not provided.

If we want to make it optional, need to amend the function so as not to attempt selecting that column from data (

affiliations = data[, affiliation.column]
)

Reprex:

library(labeleR)
#> Welcome to the labeleR package! Let's create some labels!
#>  Amazing! This is just like magic! 
#> 
#>  Package developed by Julia G. de Aledo & Ignacio Ramos-Gutiérrez
#>  🐦  TW:  @juliagdealedo 
#>  🐦  TW:  @iramosgutierrez
#> 

data <- read_sheet(url = 'https://docs.google.com/spreadsheets/d
        /16smXdP-Ehwu1cEmJTbJI1DerIpUrOcD7H5Ni6z9B07M/edit#gid=0')
create_badge(
  data = data,
  path = "labeleR_output",
  event = "INTERNATIONAL CONFERENCE OF MUGGLEOLOGY",
  name.column = "List",
  # affiliation.column = "Affiliation",
  lpic = NULL,
  rpic = NULL)
#> The specified folder does not exist. Creating folder
#> Error in `[.data.frame`(data, , affiliation.column): undefined columns selected

Created on 2023-05-19 with reprex v2.0.2

At first we made the affiliation.column as a requirement since we thought that in congress badges this field is always provided. However, I believe it can be restructured to optional for more flexibility.
It is easily editable following the same procedure we did it for the herbarium_label function.

i.e. render(affiliation.column.i = if((affiliation.column=="" )){bl.char}else{data [,affiliation.column]})