as.comment: Create and Manipulate Comment Objects

Description Usage Arguments Details Value Author(s) References Examples

Description

Some conventions include the use of ‘C’ or ‘.’ as the first element in a row. ‘C’ is typically used to identify a row to be ignored “commented-out”. Here, a comment is really a logical that should never be NA, and prints as ‘C’ or ‘.’ (TRUE,FALSE).

Usage

 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
## S3 method for class 'comment'
x[..., drop = TRUE]
## S3 method for class 'comment'
x[[..., drop = TRUE]]
## Default S3 method:
as.comment(x, ...)
## S3 method for class 'comment'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'comment'
as.character(x, ...)
## S3 method for class 'comment'
as.comment(x, ...)
## S3 method for class 'comment'
c(..., recursive = FALSE)
## S3 method for class 'comment'
format(x, ...)
## S3 method for class 'data.frame'
hide(x, where, why, ...)
## S3 method for class 'comment'
print(x, ...)
## S3 method for class 'comment'
rep(x, ...)
## S3 method for class 'data.frame'
hidden(x, ...)
## S3 method for class 'comment'
unique(x,incomparables=FALSE,...)
## S3 method for class 'comment'
xtfrm(x)
## S3 method for class 'hidden.data.frame'
summary(object, ...)

Arguments

x

the comment object, or something coercible to logical (data.frame for hidden.data.frame)

...

extra arguments, generally ignored

drop

coerce to lowest possible dimension

row.names

row names for the result

optional

Optional to use the object name as the column name?

recursive

unused, present for historical reasons

where

logical with length nrow(x), indicating rows to hide

why

a column name suggesting the reason for hiding

object

hidden.data.frame

incomparables

see unique

Details

Objects of class comment can be used exactly like logicals, but look like conventional comments. hide.data.frame implements consistent commenting of rows, including a reason for the comment. hidden and summary methods analyze the result. hidden.data.frame returns just the hidden rows, classified as ‘hidden.data.frame’. summary.hidden.data.frame indicates, for each flag, the number of records commented for that reason (total) and the number of records commented for only that reason (unique), if any. If hidden(x) has no hide flags, the result is a data frame with one cell: ncol=0. If hidden(x) has no rows, the result is a data frame with one cell: nrow=0.

Value

comment, or data.frame for hide.data.frame, etc.

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

Examples

1
2
3
4
5
Theoph <- hide(Theoph, where=Theoph$conc < 1,why='blq')
Theoph <- hide(Theoph, where=Theoph$Subject==1,why='suspect')
hidden(Theoph)
summary(hidden(Theoph))
format(as.comment(c(TRUE,FALSE,NA)))

metrumrg documentation built on May 2, 2019, 5:55 p.m.