File: matrix-gridVector.Rd

package info (click to toggle)
fbasics 4052.98-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,020 kB
  • sloc: ansic: 738; makefile: 14
file content (57 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download | duplicates (2)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
\name{gridVector}
\alias{gridVector}


\title{Grid vector coordinates}

\description{
  Creates rectangular grid coordinates from two vectors.
}

\usage{
gridVector(x, y = NULL)
}

\arguments{

  \item{x,y}{
    numeric vectors
  }
}

\details{

  The grid is obtained by pairing each element of \code{y} with all
  elements of \code{x}. The \code{X} and \code{Y} coordinates of the
  points are stored in separate vectors. This is convenient, for
  example, for plotting. It can be useful also for brute force
  optimisation or simulation.
      
  If \code{y} is \code{NULL}, the default, then \code{y = x}.

}

\value{

  a list with two components, \code{X} and \code{Y}, giving the
  coordinates which span the bivariate grid.

}

\seealso{
  \code{\link{expand.grid}}
}

\examples{
## a small grid vector with row and col transformations
gridVector(0:2)
data.frame(gridVector(0:2))
do.call("rbind", gridVector(0:2))

gridVector(0:2, 0:3)

## grid over a unit square
gridVector((0:10)/10) # equivalently: gridVector((0:10)/10, (0:10)/10)
}

\keyword{hplot}