The R Project SVN R

Rev

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

Rev 74360 Rev 82562
Line 1... Line 1...
1
% File src/library/utils/man/relist.Rd
1
% File src/library/utils/man/relist.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2008 R Core Team
3
% Copyright 1995-2022 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{relist}
6
\name{relist}
7
\alias{relist}
7
\alias{relist}
8
\alias{relist.default}
8
\alias{relist.default}
Line 84... Line 84...
84
  \code{unlist(as.relistable(obj))}
84
  \code{unlist(as.relistable(obj))}
85
  then the skeleton attribute is automatically set.  (Note that this
85
  then the skeleton attribute is automatically set.  (Note that this
86
  does not apply to the example here, as \code{\link{optim}} is creating
86
  does not apply to the example here, as \code{\link{optim}} is creating
87
  a new vector to pass to \code{ll} and not its \code{par} argument.)
87
  a new vector to pass to \code{ll} and not its \code{par} argument.)
88
 
88
 
89
  As long as \code{skeleton} has the right shape, it should be a precise inverse
89
  As long as \code{skeleton} has the right shape, it should be an inverse
90
  of \code{\link{unlist}}.  These equalities hold:
90
  of \code{\link{unlist}}.  These equalities hold:
91
\preformatted{   relist(unlist(x), x) == x
91
\preformatted{   relist(unlist(x), x) == x
92
   unlist(relist(y, skeleton)) == y
92
   unlist(relist(y, skeleton)) == y
93
 
93
 
94
   x <- as.relistable(x)
94
   x <- as.relistable(x)
95
   relist(unlist(x)) == x
95
   relist(unlist(x)) == x
96
}
96
}
-
 
97
  Note however that the relisted object might not be
-
 
98
  \emph{\link{identical}} to the skeleton because of implicit coercions
-
 
99
  performed during the unlisting step.  All elements of the relisted
-
 
100
  objects have the same type as the unlisted object.  \code{NULL} values
-
 
101
  are coerced to empty vectors of that type.
97
}% details
102
}% details
98
\value{
103
\value{
99
  an object of (S3) class \code{"relistable"} (and \code{"\link{list}"}).
104
  an object of (S3) class \code{"relistable"} (and \code{"\link{list}"}).
100
}
105
}
101
\author{
106
\author{