#==========================================================================================#
#==========================================================================================#
# This function assigns attributes to a var whilst keeping the same properties. #
#------------------------------------------------------------------------------------------#
attributed.var <<- function(x,attrlist){
#----- Check that attrlist is a list. -------------------------------------------------#
if (! is.list(attrlist)){
stop("attrlist must be a list")
}#end if
#---------------------------------------------------------------------------------------#
#---------------------------------------------------------------------------------------#
# Either append or create a list of attributes. #
#---------------------------------------------------------------------------------------#
if (is.null(attributes(x))){
attributes(x) = attrlist
}else{
attributes(x) = modifyList(x=attributes(x),val=attrlist)
}#end if
#---------------------------------------------------------------------------------------#
return(x)
}#end function attributed.var
#==========================================================================================#
#==========================================================================================#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.