Rutils/maybe-not-useful/attributed.var.r

#==========================================================================================#
#==========================================================================================#
#     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
#==========================================================================================#
#==========================================================================================#
manfredo89/ED2io documentation built on May 21, 2019, 11:24 a.m.