-
Notifications
You must be signed in to change notification settings - Fork 24
/
getComment.R
35 lines (34 loc) · 951 Bytes
/
getComment.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#' getComment
#'
#' Extracts the comment from a MAgPIE-object
#'
#'
#' @aliases getComment getComment<- setComment
#' @param x,object MAgPIE object
#' @param value,nm A vector containing the comment.
#' @return getComment returns the comment attached to a MAgPIE-object, NULL if
#' no comment is present. setComment returns the magpie object with the
#' modified comment.
#' @author Markus Bonsch
#' @seealso \code{\link{getRegions}}, \code{\link{getNames}},
#' \code{\link{getYears}}, \code{\link{getCPR}}, \code{\link{read.magpie}},
#' \code{\link{write.magpie}}, \code{"\linkS4class{magpie}"}
#' @examples
#'
#' a <- as.magpie(1)
#' #returns NULL
#' getComment(a)
#' #set the comment
#' getComment(a)<-c("bla","blubb")
#' getComment(a)
#'
#' @export
getComment <- function(x) {
return(attr(x,"comment"))
}
#' @describeIn getComment set comment
#' @export
"getComment<-" <- function(x,value) {
attr(x,"comment")<-value
return(x)
}