[Rd] colour palettes in biplot

2015-07-10 Thread G. Sawitzki
biplot could benefit from allowing colour palettes,

eg. allowing col=list(xcol= xxpal, ycol= yypal) where xxpal and yypal
are palettes.

For an example, see the robust pricipal components in the principal
componetent section of



The required change is to replace
col[1L] resp. col[2L] by col[1L]] reep. col[[2L]] for example in

 plot(x, type = "n", xlim = xlim, ylim = ylim, col = col[[1L]], ## <<
 xlab = xlab, ylab = ylab, sub = sub, main = main, ...)


Existing code should not be broken by this change.

Yours,
  gs.


>From valentin.todo...@chello.at:
> library(rrcov)
> 
> pc <- PcaProj(iris[,1:4], 3, scale=TRUE)
> windows(8,5)
> par(mfrow=c(1,2))
> biplot(pc)
> 
> col <- list(xcol=as.numeric(iris[,5])+2, ycol="red")
> biplot(pc, col=col)
> 

-- 
G. Sawitzki
StatLab Heidelberg
Im Neuenheimer Feld 294
D 69120 Heidelberg
Tel. (+49) 62 21 - 54 89 79   Fax (+49) 62 21 - 54 53 31

GPG Fingerprint: FEA4 3F2A 88B2 2629 6CE2 0429 CC3C E49E D159 99AE

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] User Input

2015-07-10 Thread Glenn Schultz

All,

I have a package BondLab, all variables are passed to the models via Cusip 
objects.  

The only variables input by the user are 
settlement date, 
price or yield or spread.  

Further price may be passed as 100.125, 100-8 (1/8), or 100-2 (2/64) or 100-2+ 
(5/128). 

Once passed these variables must have a steady state (in decimal).  After 
reading the R documentation and Hadley's book I think the way to do this is via 
a class but I can quite get my head around how to do it.  A nominal model is:

Analytics <- function(bondid = cusip, tradedate = trade.date, settledate = 
settle.date, price = 100.125){
BondAnalytics <- BondAnalytics(tradedate = tradedate, settledate = settledate, 
price = price)
New("BondAnalytics ...)
}  

So, price is an input to a constructor function which calls other functions to 
create the class object BondAnalytics.  If price is an object with validity how 
do I make that part of the function?

If I do make it class how does it function input inherit?  I read John 
Chamber's book but I am not sure... maybe it does not have to be a class but 
something else or is it something like the below:

BondAnalytics <- function(bond.id = "character", tradedate = "character", settledate = 
"character", price = .Object){
do stuff...}

Advice appreciated,
-glenn

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel