[Analogue-commits] r279 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Aug 1 23:52:17 CEST 2012
Author: gsimpson
Date: 2012-08-01 23:52:17 +0200 (Wed, 01 Aug 2012)
New Revision: 279
Added:
pkg/R/fitted.pcr.R
Log:
missed one of the existing pcr methods
Added: pkg/R/fitted.pcr.R
===================================================================
--- pkg/R/fitted.pcr.R (rev 0)
+++ pkg/R/fitted.pcr.R 2012-08-01 21:52:17 UTC (rev 279)
@@ -0,0 +1,14 @@
+`fitted.pcr` <- function(object, comps = NULL, ...) {
+ fits <- object$fitted.values
+ nc <- NCOL(fits)
+ if(is.null(comps))
+ comps <- seq_len(nc)
+ else {
+ if(!is.numeric(comps))
+ stop("Non-numeric selection of components requested.")
+ if(min(comps) < 1 || max(comps) > nc)
+ stop("Requested components outside range of actual components.")
+ }
+ fits <- fits[, comps]
+ fits
+}
More information about the Analogue-commits
mailing list