File: verbalogic.Rd

package info (click to toggle)
r-cran-spatstat.utils 1.13-0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 444 kB
  • sloc: ansic: 1,390; sh: 4; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,988 bytes parent folder | download | duplicates (4)
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
58
59
60
61
62
63
64
65
66
67
\name{verbalogic}
\alias{verbalogic}
\title{
  Verbal Logic
}
\description{
  Perform the specified logical operation
  on the character vector \code{x}, recognising the
  special strings \code{"TRUE"} and \code{"FALSE"}
  and treating other strings as logical variables.
}
\usage{
verbalogic(x, op = "and")
}
\arguments{
  \item{x}{
     Character vector.
  }
  \item{op}{
    Logical operation: one of the character strings
    \code{"and"}, \code{"or"} or \code{"not"}.
  }
}
\details{
  This function performs simple logical operations
  on character strings that represent human-readable statements.

  The character vector \code{x} may contain any strings:
  the special strings \code{"TRUE"} and \code{"FALSE"} are
  treated as the logical values \code{TRUE} and \code{FALSE},
  while all other strings are treated as if they were
  logical variables.

  If \code{op="and"}, the result is a single string,
  logically equivalent to \code{x[1] && x[2] && ... && x[n]}.
  First, any entries of \code{x} equal to \code{"TRUE"} are removed.
  The result is \code{"FALSE"} if any of the entries of \code{x}
  is \code{"FALSE"}; otherwise it is equivalent to
  \code{paste(x, collapse=" and ")}.

  If \code{op="or"}, the result is a single string, logically equivalent to
  \code{x[1] || x[2] || ... || x[n]}. 
  First, any entries of \code{x} equal to \code{"FALSE"} are removed.
  The result is \code{"TRUE"} if any of the entries of \code{x}
  is \code{"TRUE"}; otherwise it is equivalent to
  \code{paste(x, collapse=" or ")}.

  If \code{op="not"}, the result is a character vector \code{y}
  such that \code{y[i]} is the logical negation of \code{x[i]}.

  The code does not understand English grammar and cannot expand logical
  expressions.
}
\value{
  A character string.
}
\author{
  \adrian.
}
\examples{
   x <- c("The sky is blue", "my name is not Einstein", "FALSE")
   verbalogic(x, "and")
   verbalogic(x, "or")
   verbalogic(x, "not")
}
\keyword{logic}
\keyword{manip}