The R Project SVN R

Rev

Rev 33065 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
27442 ripley 1
\name{edit.data.frame}
2
\alias{edit.data.frame}
3
\alias{edit.matrix}
4
\title{Edit Data Frames and Matrices}
5
\description{
6
  Use data editor on data frame or matrix contents.
7
}
8
\usage{
9
\method{edit}{data.frame}(name, factor.mode = c("character", "numeric"),
10
     edit.row.names = any(row.names(name) != 1:nrow(name)), \dots)
11
 
12
\method{edit}{matrix}(name, edit.row.names = any(rownames(name) != 1:nrow(name)), \dots)
13
}
14
\arguments{
15
  \item{name}{A data frame or matrix.}
16
  \item{factor.mode}{How to handle factors (as integers or using
17
    character levels) in a data frame.}
18
  \item{edit.row.names}{logical. Show the row names be displayed as
19
    a separate editable column?}
20
  \item{\dots}{further arguments passed to or from other methods.}
21
}
22
\details{
23
  At present, this only works on simple data frames containing numeric, 
24
  logical or character vectors and factors. Factors are represented in the
25
  spreadsheet as either numeric vectors (which is more suitable for data
26
  entry) or character vectors (better for browsing). After editing,
27
  vectors are padded with \code{NA} to have the same length and
28
  factor attributes are restored.  The set of factor levels can not be
29
  changed by editing in numeric mode; invalid levels are changed to
30
  \code{NA} and a warning is issued.  If new factor levels are
31
  introduced in character mode, they are added at the end of the list of
32
  levels in the order in which they encountered.
33
 
34
  It is possible to use the data-editor's facilities to select the mode
35
  of columns to swap between numerical and factor columns in a data
36
  frame.  Changing any column in a numerical matrix to character will
37
  cause the result to be coerced to a character matrix.  Changing 
38
  the mode of logical columns is not supported.
39
}
40
\value{
41
  The edited data frame.
42
}
43
\author{ Peter Dalgaard }
44
\note{
45
  \code{fix(dataframe)} works for in-place editing by calling this
46
  function.
47
 
48
  If the data editor is not available, a dump of the object is presented
49
  for editing using the default method of \code{edit}.
50
 
51
  At present the data editor is limited to 65535 rows.
52
}
53
\seealso{\code{\link{data.entry}}, \code{\link{edit}}}
54
\examples{
55
\dontrun{
56
data(InsectSprays)
57
edit(InsectSprays)
58
edit(InsectSprays, factor.mode="numeric")
59
}
60
}
61
 
62
\keyword{utilities}