[inlinedocs] document custom operators %x% and bracket operator [ ?

Lars Schmidt-Thieme schmidt-thieme at ismll.de
Wed Mar 7 04:21:14 CET 2012


Dear inlinedocs authors,

is it possible to document
* custom operators "%x%" and
* the bracket operator "["  ?

I tried (with inlinedocs v1.9, R 2.11.0) and got the following error messages:

1. error bracket:
Error in parse(text = utxt) : unexpected '[' in:
"
["
Calls: package.skeleton.dx -> modify.Rd.file -> parse
Execution halted

2. error custom operator:
Error in parse(text = utxt) :
  unexpected ',' in:
"
---percent---p---percent---(x,"
Calls: package.skeleton.dx -> modify.Rd.file -> parse
Execution halted

Example code was:

1. example custom operator:
"%p%" = function(
##title<< add two numbers
  x,  ##<< first number
  y   ##<< second number
){
  x + y;
  ##value<< sum of x and y
}

2. example bracket:
LIN = function(
##title<< create a linear function
  slope,     ##<< slope
  intercept  ##<< intercept
) {
  f = list(slope=slope, intercept=intercept);
  class(f)= "LIN";
  f;
  ##value<< object of class LIN
}

"[.LIN" = function(
##title<< evaluate linear function
  f, ##<< linear function to evaluate, object of class LIN
  x  ##<< position(s) to evaluate f at
){
  f$slope * x + f$intercept;
  ##value<< function value(s) of f at x
}

Thanks for this package, now documenting code is exactly
as it should be -- a byproduct of coding.

Thanks a lot in advance!
& best regards
  Lars


More information about the Inlinedocs-support mailing list