The R Project SVN R

Rev

Rev 60405 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 60405 Rev 61433
Line 21... Line 21...
21
}
21
}
22
\arguments{
22
\arguments{
23
  \item{object}{Any R object.}
23
  \item{object}{Any R object.}
24
 
24
 
25
  \item{flag}{Optional, logical: indicate direction of conversion.}
25
  \item{flag}{Optional, logical: indicate direction of conversion.}
26
  
26
 
27
  \item{complete}{Optional, logical: whether conversion to S3 is
27
  \item{complete}{Optional, logical: whether conversion to S3 is
28
    completed.  Not usually needed, but see the details section.}
28
    completed.  Not usually needed, but see the details section.}
29
}
29
}
30
 
30
 
31
\details{
31
\details{
32
  Note that \code{isS4} does not rely on the \pkg{methods}
32
  Note that \code{isS4} does not rely on the \pkg{methods}
33
  package, so in particular it can be used to detect the need to
33
  package, so in particular it can be used to detect the need to
34
  \code{\link{require}} that package.
34
  \code{\link{require}} that package.
35
    
35
 
36
  \code{asS3} uses the value of
36
  \code{asS3} uses the value of
37
  \code{complete} to control whether an attempt is made to transform
37
  \code{complete} to control whether an attempt is made to transform
38
  \code{object} into a valid object of the implied S3 class.  If
38
  \code{object} into a valid object of the implied S3 class.  If
39
  \code{complete} is \code{TRUE},
39
  \code{complete} is \code{TRUE},
40
  then an object from an S4 class extending an S3 class will be
40
  then an object from an S4 class extending an S3 class will be
Line 49... Line 49...
49
\value{
49
\value{
50
  \code{isS4} always returns \code{TRUE} or \code{FALSE} according to
50
  \code{isS4} always returns \code{TRUE} or \code{FALSE} according to
51
  whether the internal flag marking an S4 object has been turned on for
51
  whether the internal flag marking an S4 object has been turned on for
52
  this object.
52
  this object.
53
 
53
 
54
  \code{asS4} and \code{asS3} will turn this flag on or off, 
54
  \code{asS4} and \code{asS3} will turn this flag on or off,
55
  and \code{asS3} will set the class from the objects \code{.S3Class}
55
  and \code{asS3} will set the class from the objects \code{.S3Class}
56
  slot if one exists.  Note that \code{asS3} will \emph{not}  turn
56
  slot if one exists.  Note that \code{asS3} will \emph{not}  turn
57
  the object into an S3 object
57
  the object into an S3 object
58
  unless there is a valid conversion; that is, an object of type other
58
  unless there is a valid conversion; that is, an object of type other
59
  than \code{"S4"} for which the S4 object is an extension, unless
59
  than \code{"S4"} for which the S4 object is an extension, unless
Line 70... Line 70...
70
isS4(pi) # FALSE
70
isS4(pi) # FALSE
71
isS4(getClass("MethodDefinition")) # TRUE
71
isS4(getClass("MethodDefinition")) # TRUE
72
\dontshow{
72
\dontshow{
73
stopifnot(isS4(asS4(Sys.time())))
73
stopifnot(isS4(asS4(Sys.time())))
74
## Following is a correction of previous behavior. See note in the
74
## Following is a correction of previous behavior. See note in the
75
## value section above 
75
## value section above
76
stopifnot(isS4(asS4(getClass("MethodDefinition"), FALSE, 2)))
76
stopifnot(isS4(asS4(getClass("MethodDefinition"), FALSE, 2)))
77
stopifnot(!isS4(asS4(getClass("MethodDefinition"), FALSE, 0)))
77
stopifnot(!isS4(asS4(getClass("MethodDefinition"), FALSE, 0)))
78
}
78
}
79
}
79
}
80
\keyword{programming}
80
\keyword{programming}