collapse_and <- function(x,oxford=TRUE,ampersand=FALSE){
if(length(x)==1){
return(x)
}else{
commas <- paste(x[1:(length(x)-1)],collapse=', ')
out <- paste(commas,x[length(x)],sep=ifelse(ampersand,ifelse(oxford,', & ',' & '), ifelse(oxford,', and ',' and ')))
return(out)
}
}
collapse_or <- function(x,oxford=TRUE){
if(length(x)==1){
return(x)
}else{
commas <- paste(x[1:(length(x)-1)],collapse=', ')
out <- paste(commas,x[length(x)],sep=ifelse(oxford,', or ',' or '))
return(out)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.