The R Project SVN R

Rev

Rev 86034 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 86034 Rev 86395
Line 56... Line 56...
56
    suitable character vectors as above, or numeric version objects.
56
    suitable character vectors as above, or numeric version objects.
57
    For \code{is.numeric_version} and \code{is.package_version},
57
    For \code{is.numeric_version} and \code{is.package_version},
58
    arbitrary R objects.
58
    arbitrary R objects.
59
  }
59
  }
60
  \item{strict}{a logical indicating whether invalid numeric versions
60
  \item{strict}{a logical indicating whether invalid numeric versions
61
    should results in an error (default) or not.}
61
    should result in an error (default) or not.}
62
}
62
}
63
\details{
63
\details{
64
  Numeric versions are sequences of one or more non-negative integers,
64
  Numeric versions are sequences of one or more non-negative integers,
65
  usually (e.g., in package \file{DESCRIPTION} files) represented as
65
  usually (e.g., in package \file{DESCRIPTION} files) represented as
66
  character strings with the elements of the sequence concatenated and
66
  character strings with the elements of the sequence concatenated and
Line 99... Line 99...
99
  cat("Your version of R, ", as.character(getRversion()),
99
  cat("Your version of R, ", as.character(getRversion()),
100
      ", is outdated.\n",
100
      ", is outdated.\n",
101
      "Now trying to work around that ...\n", sep = "")
101
      "Now trying to work around that ...\n", sep = "")
102
}
102
}
103
 
103
 
-
 
104
x[[1]]
104
x[[c(1, 3)]]  # '4' as a numeric vector, same as x[1, 3]
105
x[[c(1, 3)]]  # '4' as a numeric version
-
 
106
x[1, 3]       # same
105
x[1, 3]      # 4 as an integer
107
x[[1, 3]]     # 4 as an integer
-
 
108
 
106
x[[2, 3]] <- 0   # zero the patchlevel
109
x[[2, 3]] <- 0    # zero the patchlevel
107
x[[c(2, 3)]] <- 0 # same
110
x[[c(2, 3)]] <- 0 # same
108
x
111
x
-
 
112
 
109
x[[3]] <- "2.2.3"; x
113
x[[3]] <- "2.2.3"
-
 
114
x
-
 
115
 
110
x <- c(x, package_version("0.0"))
116
x <- c(x, package_version("0.0"))
111
is.na(x)[4] <- TRUE
117
is.na(x)[4] <- TRUE
112
stopifnot(identical(is.na(x), c(rep(FALSE,3), TRUE)),
118
stopifnot(identical(is.na(x), c(rep(FALSE,3), TRUE)),
113
	  anyNA(x))
119
	  anyNA(x))
114
}
120
}