[R-SIG-Finance] Regression in fPortfolio? Sorting by date does not work...

Nicolas Chapados nicolas.chapados at gmail.com
Tue Sep 1 16:35:20 CEST 2009


I am currently following the examples in the ebook "Portfolio
Optimization with R/RMetrics" (by Würtz et al.) and the example on p.
16 simply does not work.  Here is what I get::

> set.seed(1953)
> charvec <- format(timeCalendar(2008, sample(12,6)))
> data <- matrix(round(rnorm(6), 3))
> t1 <- sort(timeSeries(data, charvec, units="A"))
Error in is.unsorted(x at positions, na.rm = na.rm) :
  1 argument passed to .Internal(is.unsorted) which requires 2

I'm using the latest binary R from CRAN (2.9.1) on Ubuntu 9.04, and
all RMetrics packages installed from scratch yesterday.  I just did an
update.packages() as suggested on p. xiii of the ebook.  So everything
should be fresh as on CRAN (as of August 31st, 2009).  For the record,
here is the transcript I obtain after loading library(fPortfolio)
immediately after starting R::

> library(fPortfolio)
Loading required package: MASS
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fCopulae
Loading required package: sn
Loading required package: mnormt
Package 'sn', 0.4-12 (2009-03-21). Type 'help(SN)' for summary information
Loading required package: adapt
Loading required package: fAssets
Loading required package: robustbase

Attaching package: 'fAssets'


	The following object(s) are masked from package:fCopulae :

	 .mvstFit

Loading required package: quadprog
Loading required package: Rglpk
Loading required package: slam

Attaching package: 'slam'


	The following object(s) are masked from package:timeSeries :

	 colMeans,
	 colSums


	The following object(s) are masked from package:base :

	 colMeans,
	 colSums,
	 rowMeans,
	 rowSums

Using the GLPK callable library version 4.37
Loading required package: Rsymphony
Warning message:
'DESCRIPTION' file has 'Encoding' field and re-encoding is not possible



This error is somewhat bothersome, since the sorting functions are
used in many places within RMetrics...

Any help is greatly appreciated!

Many thanks,
+ Nicolas Chapados



More information about the R-SIG-Finance mailing list