Learn R Programming

writexl (version 1.5.1)

xl_formula: Excel Types

Description

Create special column types to write to a spreadsheet

Usage

xl_formula(x)

xl_hyperlink(url, name = NULL)

Arguments

x

character vector to be interpreted as formula

url

character vector of URLs

name

character vector of friendly names

Examples

Run this code
df <- data.frame(
  name = c("UCLA", "Berkeley", "Jeroen"),
  founded = c(1919, 1868, 2030),
  website = xl_hyperlink(c("http://www.ucla.edu", "http://www.berkeley.edu", NA), "homepage")
)
df$age <- xl_formula('=(YEAR(TODAY()) - INDIRECT("B" & ROW()))')
write_xlsx(df, 'universities.xlsx')

# cleanup
unlink('universities.xlsx')

Run the code above in your browser using DataLab