Re: [R] tapply changing order of factor levels?

2009-05-06 Thread Chirantan Kundu
Hi Ellison,

Thanks for pointing it out. Bad miss on my part.

Regards.

On Wed, May 6, 2009 at 7:55 PM, S Ellison  wrote:

> The problem is in the code.
>
> When you say
> >> mysummary<-tapply(myfactor,mydata,length)
> >> mysummary
>
> you have used mydata as a factor and myfactor as  the data.
>
> tapply has (correctly) used the ordered labels in the grouping factor
> (mydata) to label its output.
>
> If you did what you probably intended:
> tapply(mydata, myfactor,length)
>
> you'll get the order you expected.
>
>
>
> ***
> This email and any attachments are confidential. Any u...{{dropped:15}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] tapply changing order of factor levels?

2009-05-06 Thread Chirantan Kundu
Hi Alain,

I tried levels(myfactor) as you suggested.

> levels(myfactor)
[1] "IN0020020155" "IN0019800021" "IN0020020064"

The order is preserved, no alphanumerical sorting done here.
Regards.

On Wed, May 6, 2009 at 7:35 PM, Alain Guillet wrote:

> Hi,
>
> I don't believe the problem is related to tapply. I would say it is because
> of the factor. In fact, the order of a factor is given by the alphanumerical
> order of his levels. You can see it with levels(myfactor).
> I you want to change the order, redefine the levels of myfactor with the
> expected order or use the function ordered.
>
> Alain
>
>
> Chirantan Kundu wrote:
>
>> Hi,
>>
>> Does tapply change the order when applied on a factor? Below is the code I
>> tried.
>>
>>
>>
>>> mylevels<-c("IN0020020155","IN0019800021","IN0020020064")
>>>
>>>
>>>
>>
>> mydata<-c("IN0020020155","IN0019800021","IN0020020064","IN0020020155","IN0019800021","IN0019800021","IN0020020064","IN0020020064","IN0019800021")
>>
>>
>>> myfactor<-factor(mydata,levels=mylevels)
>>> myfactor
>>>
>>>
>> [1] IN0020020155 IN0019800021 IN0020020064 IN0020020155 IN0019800021
>> IN0019800021 IN0020020064 IN0020020064 IN0019800021
>> Levels: IN0020020155 IN0019800021 IN0020020064
>>
>>
>>> summary(myfactor)
>>>
>>>
>> IN0020020155 IN0019800021 IN0020020064
>>   243
>>
>> # Everything fine upto this point. The order of levels is maintained as it
>> is.
>>
>>
>>
>>> mysummary<-tapply(myfactor,mydata,length)
>>> mysummary
>>>
>>>
>> IN0019800021 IN0020020064 IN0020020155
>>   432
>>
>> # Now the order has changed.
>>
>> Is this the expected behavior? Any idea on how to avoid the change in
>> order?
>>
>> Regards,
>> Chirantan
>>
>> 
>> Visit us at http://www.2pirad.com
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>
> --
> Alain Guillet
> Statistician and Computer Scientist
>
> SMCS - Institut de statistique - Université catholique de Louvain
> Bureau d.126
> Voie du Roman Pays, 20
> B-1348 Louvain-la-Neuve
> Belgium
>
> tel: +32 10 47 30 50
>
>


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] tapply changing order of factor levels?

2009-05-06 Thread Chirantan Kundu
Thanks, Jim.
It works!

On Wed, May 6, 2009 at 7:26 PM, jim holtman  wrote:

> The result of 'tapply' is just a named vector and the names are in
> alphabetical order.  If you want them printed in a different order, then you
> have to specify it.  Since you have the order in 'mylevels', this will work:
>
> > str(mysummary)
>  int [1:3(1d)] 4 3 2
>  - attr(*, "dimnames")=List of 1
>   ..$ : chr [1:3] "IN0019800021" "IN0020020064" "IN0020020155"
> > mysummary[mylevels]
> IN0020020155 IN0019800021 IN0020020064
>243
> >
>
>
> On Wed, May 6, 2009 at 9:45 AM, Chirantan Kundu wrote:
>
>> Hi,
>>
>> Does tapply change the order when applied on a factor? Below is the code I
>> tried.
>>
>> > mylevels<-c("IN0020020155","IN0019800021","IN0020020064")
>> >
>>
>> mydata<-c("IN0020020155","IN0019800021","IN0020020064","IN0020020155","IN0019800021","IN0019800021","IN0020020064","IN0020020064","IN0019800021")
>> > myfactor<-factor(mydata,levels=mylevels)
>> > myfactor
>> [1] IN0020020155 IN0019800021 IN0020020064 IN0020020155 IN0019800021
>> IN0019800021 IN0020020064 IN0020020064 IN0019800021
>> Levels: IN0020020155 IN0019800021 IN0020020064
>> > summary(myfactor)
>> IN0020020155 IN0019800021 IN0020020064
>>   243
>>
>> # Everything fine upto this point. The order of levels is maintained as it
>> is.
>>
>> > mysummary<-tapply(myfactor,mydata,length)
>> > mysummary
>> IN0019800021 IN0020020064 IN0020020155
>>   432
>>
>> # Now the order has changed.
>>
>> Is this the expected behavior? Any idea on how to avoid the change in
>> order?
>>
>> Regards,
>> Chirantan
>>
>> 
>> Visit us at http://www.2pirad.com
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] tapply changing order of factor levels?

2009-05-06 Thread Chirantan Kundu
Hi,

Does tapply change the order when applied on a factor? Below is the code I
tried.

> mylevels<-c("IN0020020155","IN0019800021","IN0020020064")
>
mydata<-c("IN0020020155","IN0019800021","IN0020020064","IN0020020155","IN0019800021","IN0019800021","IN0020020064","IN0020020064","IN0019800021")
> myfactor<-factor(mydata,levels=mylevels)
> myfactor
[1] IN0020020155 IN0019800021 IN0020020064 IN0020020155 IN0019800021
IN0019800021 IN0020020064 IN0020020064 IN0019800021
Levels: IN0020020155 IN0019800021 IN0020020064
> summary(myfactor)
IN0020020155 IN0019800021 IN0020020064
   243

# Everything fine upto this point. The order of levels is maintained as it
is.

> mysummary<-tapply(myfactor,mydata,length)
> mysummary
IN0019800021 IN0020020064 IN0020020155
   432

# Now the order has changed.

Is this the expected behavior? Any idea on how to avoid the change in order?

Regards,
Chirantan


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't build termstrc package from source

2009-05-05 Thread Chirantan Kundu
Thanks, Uwe.
I've managed to get it done with R CMD BUILD -binary.

2009/5/5 Uwe Ligges 

> I guess you asked R to:
>
>   R CMD build ...
>
> which builds the source package, but you need
>
>   R CMD INSTALL ...
>
> in order to install the package or
>
> R CMD INSTALL --build  ...
>
> in order to install *and* build a binary package. See the manual R
> Installation and Administration.
>
> Uwe Ligges
>
>
>
>
>
>
>
> Chirantan Kundu wrote:
>
>> Hi,
>>
>> I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on
>> Windows XP. However instead of building the package it just zips the
>> entire
>> source into a .tar.gz file.
>> This is the first time I'm trying to build an R package from source. I
>> installed the R toolset for Windows and set RTools as well as Perl & MinGW
>> directories in the path.
>> Anybody tried this out? Any file missing in the source?
>>
>> Any help is appreciated.
>>
>> Thanks,
>> Chirantan
>>
>> 
>> Visit us at http://www.2pirad.com
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't build termstrc package from source

2009-05-05 Thread Chirantan Kundu
Thanks, Peter.
R CMD build --binary did it for me.

On Tue, May 5, 2009 at 3:36 PM, Peter Dalgaard wrote:

> Chirantan Kundu wrote:
> > Hi,
> >
> > I'm trying to build the termstrc 1.1 package from its source on R 2.7.2
> on
> > Windows XP. However instead of building the package it just zips the
> entire
> > source into a .tar.gz file.
> > This is the first time I'm trying to build an R package from source. I
> > installed the R toolset for Windows and set RTools as well as Perl &
> MinGW
> > directories in the path.
> > Anybody tried this out? Any file missing in the source?
> >
> > Any help is appreciated.
>
> It's hard to tell what you did wrong when you don't tell what you did.
>
> I suspect you need to study the difference between
>
> R CMD build
> R CMD INSTALL
> R CMD check
> R CMD build --binary
>
> --
>   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
> ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907
>
>


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Can't build termstrc package from source

2009-05-05 Thread Chirantan Kundu
Hi,

I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on
Windows XP. However instead of building the package it just zips the entire
source into a .tar.gz file.
This is the first time I'm trying to build an R package from source. I
installed the R toolset for Windows and set RTools as well as Perl & MinGW
directories in the path.
Anybody tried this out? Any file missing in the source?

Any help is appreciated.

Thanks,
Chirantan


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to use cubic spline coefficients from termstrc package?

2009-04-14 Thread Chirantan Kundu
Hi,

I'm using the cubic splines from termstrc package. I invoked the
splines_estim function with a group of 43 bonds. It computes 6 knot points
and returns values for alpha1 to alpha7. My question is how to use these
alpha1 to alpha7 in the equation of yield? For example, if I'm trying to
find the yield at, say, 12.25 years, which falls between 3rd & 4th knot
points what should the formula (expectedly a cubic polynomial with
coefficients from the alpha set) for the computation be?

Any help is appreciated.

Thanks,
Chirantan


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Invoking bond_prices function of termstrc package

2009-04-09 Thread Chirantan Kundu
Hi,
I'm trying to invoke the function bond_prices from termstrc package.

Here is the code snippet:

library(termstrc)
data(eurobonds)
b <- matrix(rep(c(0,0,0, 1),1),nrow=1,byrow=TRUE)
group<-c("GERMANY")
colnames(b) <- c("beta0","beta1","beta2","tau1")
germaturities<-create_maturities_matrix(eurobonds$GERMANY)
bp<-bond_prices(method =
"Nelson/Siegel",b,germaturities,eurobonds$GERMANY$CASHFLOWS$CF)
bp

Running this, I get the following warning message:
In cf * discount_factors :
  longer object length is not a multiple of shorter object length

Also the values I get (bp) seems not correct (way too high). I'm not sure if
I need to change b.

I'm on Windows XP and using R-2.7.2 + *termstrc* 1.1.

Any help will be appreciated.
Regards,


Visit us at http://www.2pirad.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to use termstrc functions?

2009-03-20 Thread Chirantan Kundu
Actually I was looking for someone who has some experience in using
the package. Anyway, thanks for your input.

On Fri, Mar 20, 2009 at 10:51 PM, David Winsemius
 wrote:
> How could I (or anyone for that matter) possibly answer that question?
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>
> On Mar 20, 2009, at 1:07 PM, Chirantan Kundu wrote:
>
>> Thanks for the help. RATING & NAME are not required for this call as
>> par documentation. About the CASHFLOWS I'm not sure as I'm going to
>> call create_cashflows_matrix which is supposed to return me the
>> cashflow matrix. Do I still need to have the CASHFLOWSlist in the
>> structure?
>>
>> On Fri, Mar 20, 2009 at 9:48 PM, David Winsemius 
>> wrote:
>>>
>>> Besides needing a grouped structure and not calling that function with a
>>> group name, your sub-structure does not seem complete when compared with
>>> the
>>> AAA group within the example dataset;
>>>
>>>> str(allbonds)  # your structure
>>>
>>> List of 1
>>>  $ mybonds:List of 7
>>>  ..$ ISIN        : chr [1:2] "IN0020080019" "IN0020020163"
>>>  ..$ MATURITYDATE:Class 'Date'  num [1:2] 14244 14974
>>>  ..$ STARTDATE   :Class 'Date'  num [1:2] 11323 11688
>>>  ..$ COUPONRATE  : num [1:2] 8.24 7.95
>>>  ..$ PRICE       : num [1:2] 50 100
>>>  ..$ ACCRUED     : num [1:2] 5 2
>>>  ..$ TODAY       :Class 'Date'  num [1:2] 14323 14323
>>>
>>>> str(corpbonds$AAA)
>>>
>>> List of 10
>>>  $ ISIN        : chr [1:20] "XS0078921441" "XS0079017637" "XS0090078907"
>>> "XS0119246626" ...
>>>  $ MATURITYDATE:Class 'Date'  num [1:20] 14476 15212 16680 15631 14203
>>> ...
>>>  $ STARTDATE   :Class 'Date'  num [1:20] 10093 10099 10471 11248 11281
>>> ...
>>>  $ COUPONRATE  : num [1:20] 0.0563 0.0575 0.0512 0.0587 0.0575 ...
>>>  $ RATING      : Factor w/ 10 levels "A","A-","A+",..: 7 7 7 7 7 7 7 7 7
>>> 7
>>> ...
>>>  $ NAME        : Factor w/ 249 levels "4.88 BP CAPITAL MARKETS PLC
>>> 31-MAR-09",..: 109 109 109 109 109 109 229 153 109 149 ...
>>>  $ PRICE       : num [1:20] 108 113 112 115 108 ...
>>>  $ ACCRUED     : num [1:20] 1.328 1.262 1.039 0.451 5.671 ...
>>>  $ CASHFLOWS   :List of 3
>>>  ..$ ISIN: chr [1:126] "XS0078921441" "XS0078921441" "XS0078921441"
>>> "XS0078921441" ...
>>>  ..$ CF  : num [1:126] 5.61 5.61 5.62 105.62 5.78 ...
>>>  ..$ DATE:Class 'Date'  num [1:126] 13381 13745 14111 14476 13388 ...
>>>  $ TODAY       :Class 'Date'  num 13102
>>>
>>> On Mar 20, 2009, at 12:05 PM, David Winsemius wrote:
>>>
>>>>
>>>> On Mar 20, 2009, at 10:15 AM, Chirantan Kundu wrote:
>>>>
>>>>> Here it goes -
>>>>>
>>>>> library(termstrc)
>>>>> ISIN <- vector()
>>>>> ISIN[1]<-"IN0020080019"
>>>>> ISIN[2]<-"IN0020020163"
>>>>> MATURITYDATE<-as.Date(c("20081231","20101231"),"%Y%m%d")
>>>>> STARTDATE<-as.Date(c("20010101","20020101"),format="%Y%m%d")
>>>>> COUPONRATE<-c(8.24,7.95)
>>>>> PRICE<-(50,100)
>>>>> ACCRUED<-c(5,2)
>>>>> TODAY<-c(Sys.Date(),Sys.Date())
>>>>> mybonds <- list(ISIN,MATURITYDATE,STARTDATE,
>>>>> COUPONRATE,PRICE,ACCRUED,TODAY)
>>>>> names(mybonds) <- c("ISIN","MATURITYDATE","STARTDATE","COUPONRATE",
>>>>> "PRICE","ACCRUED","TODAY")
>>>>> allbonds <- list(mybonds)
>>>>> names(allbonds)<-c("mybonds")
>>>>> create_cashflows_matrix(allbonds)
>>>>>
>>>>>
>>>>> I also tried -
>>>>>
>>>>> library(termstrc)
>>>>> data(corpbonds)
>>>>> create_cashflows_matrix(corpbonds)
>>>>
>>>> Your collection of bonds need to be organized in groups and the call to
>>>> create_cashflows_matrix needs to call those groups by name. In the case
>>>> of
>>>> the corpbonds dataset, this call gets you output:
>>>>
>>>> cre

Re: [R] How to use termstrc functions?

2009-03-20 Thread Chirantan Kundu
Thanks for the help. RATING & NAME are not required for this call as
par documentation. About the CASHFLOWS I'm not sure as I'm going to
call create_cashflows_matrix which is supposed to return me the
cashflow matrix. Do I still need to have the CASHFLOWSlist in the
structure?

On Fri, Mar 20, 2009 at 9:48 PM, David Winsemius  wrote:
> Besides needing a grouped structure and not calling that function with a
> group name, your sub-structure does not seem complete when compared with the
> AAA group within the example dataset;
>
>> str(allbonds)  # your structure
> List of 1
>  $ mybonds:List of 7
>  ..$ ISIN        : chr [1:2] "IN0020080019" "IN0020020163"
>  ..$ MATURITYDATE:Class 'Date'  num [1:2] 14244 14974
>  ..$ STARTDATE   :Class 'Date'  num [1:2] 11323 11688
>  ..$ COUPONRATE  : num [1:2] 8.24 7.95
>  ..$ PRICE       : num [1:2] 50 100
>  ..$ ACCRUED     : num [1:2] 5 2
>  ..$ TODAY       :Class 'Date'  num [1:2] 14323 14323
>
>> str(corpbonds$AAA)
> List of 10
>  $ ISIN        : chr [1:20] "XS0078921441" "XS0079017637" "XS0090078907"
> "XS0119246626" ...
>  $ MATURITYDATE:Class 'Date'  num [1:20] 14476 15212 16680 15631 14203 ...
>  $ STARTDATE   :Class 'Date'  num [1:20] 10093 10099 10471 11248 11281 ...
>  $ COUPONRATE  : num [1:20] 0.0563 0.0575 0.0512 0.0587 0.0575 ...
>  $ RATING      : Factor w/ 10 levels "A","A-","A+",..: 7 7 7 7 7 7 7 7 7 7
> ...
>  $ NAME        : Factor w/ 249 levels "4.88 BP CAPITAL MARKETS PLC
> 31-MAR-09",..: 109 109 109 109 109 109 229 153 109 149 ...
>  $ PRICE       : num [1:20] 108 113 112 115 108 ...
>  $ ACCRUED     : num [1:20] 1.328 1.262 1.039 0.451 5.671 ...
>  $ CASHFLOWS   :List of 3
>  ..$ ISIN: chr [1:126] "XS0078921441" "XS0078921441" "XS0078921441"
> "XS0078921441" ...
>  ..$ CF  : num [1:126] 5.61 5.61 5.62 105.62 5.78 ...
>  ..$ DATE:Class 'Date'  num [1:126] 13381 13745 14111 14476 13388 ...
>  $ TODAY       :Class 'Date'  num 13102
>
> On Mar 20, 2009, at 12:05 PM, David Winsemius wrote:
>
>>
>> On Mar 20, 2009, at 10:15 AM, Chirantan Kundu wrote:
>>
>>> Here it goes -
>>>
>>> library(termstrc)
>>> ISIN <- vector()
>>> ISIN[1]<-"IN0020080019"
>>> ISIN[2]<-"IN0020020163"
>>> MATURITYDATE<-as.Date(c("20081231","20101231"),"%Y%m%d")
>>> STARTDATE<-as.Date(c("20010101","20020101"),format="%Y%m%d")
>>> COUPONRATE<-c(8.24,7.95)
>>> PRICE<-(50,100)
>>> ACCRUED<-c(5,2)
>>> TODAY<-c(Sys.Date(),Sys.Date())
>>> mybonds <- list(ISIN,MATURITYDATE,STARTDATE,
>>> COUPONRATE,PRICE,ACCRUED,TODAY)
>>> names(mybonds) <- c("ISIN","MATURITYDATE","STARTDATE","COUPONRATE",
>>> "PRICE","ACCRUED","TODAY")
>>> allbonds <- list(mybonds)
>>> names(allbonds)<-c("mybonds")
>>> create_cashflows_matrix(allbonds)
>>>
>>>
>>> I also tried -
>>>
>>> library(termstrc)
>>> data(corpbonds)
>>> create_cashflows_matrix(corpbonds)
>>
>> Your collection of bonds need to be organized in groups and the call to
>> create_cashflows_matrix needs to call those groups by name. In the case of
>> the corpbonds dataset, this call gets you output:
>>
>> create_cashflows_matrix( corpbonds$AAA )
>>
>> --
>> David Winsemius
>>>
>>>
>>> Both result into the same error - Error in as.vector(x, mode) :
>>> invalid 'mode' argument.
>>> Regards.
>>>
>>> On Fri, Mar 20, 2009 at 7:09 PM, David Winsemius 
>>> wrote:
>>>>
>>>> Got code?
>>>>
>>>> On Mar 20, 2009, at 8:15 AM, Chirantan Kundu wrote:
>>>>>
>>>>> I'm trying to use the package termstrc. However I cannot figure out
>>>>> how to invoke helper functions like create_cashflows_matrix &
>>>>> create_maturities_matrix. Even when I try to invoke those with the
>>>>> data supplied with the package (say, corpbonds), it throws error
>>>>> saying "Error in as.vector(x, mode) : invalid 'mode' argument". Can
>>>>> anybody provide some working example for these?
>>>>> I'm on Windows XP and using R-2.7.2 + termstrc 1.1.
>>>>>
>>>>>
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>> David Winsemius, MD
>>>> Heritage Laboratories
>>>> West Hartford, CT
>>>>
>>>>
>>> 
>>> Visit us at http://www.2pirad.com
>>>
>>
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

Visit us at http://www.2pirad.com


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to use termstrc functions?

2009-03-20 Thread Chirantan Kundu
Here it goes -

library(termstrc)
ISIN <- vector()
ISIN[1]<-"IN0020080019"
ISIN[2]<-"IN0020020163"
MATURITYDATE<-as.Date(c("20081231","20101231"),"%Y%m%d")
STARTDATE<-as.Date(c("20010101","20020101"),format="%Y%m%d")
COUPONRATE<-c(8.24,7.95)
PRICE<-(50,100)
ACCRUED<-c(5,2)
TODAY<-c(Sys.Date(),Sys.Date())
mybonds <- list(ISIN,MATURITYDATE,STARTDATE,
COUPONRATE,PRICE,ACCRUED,TODAY)
names(mybonds) <- c("ISIN","MATURITYDATE","STARTDATE","COUPONRATE",
"PRICE","ACCRUED","TODAY")
allbonds <- list(mybonds)
names(allbonds)<-c("mybonds")
create_cashflows_matrix(allbonds)


I also tried -

library(termstrc)
data(corpbonds)
create_cashflows_matrix(corpbonds)

Both result into the same error - Error in as.vector(x, mode) :
invalid 'mode' argument.
Regards.

On Fri, Mar 20, 2009 at 7:09 PM, David Winsemius  wrote:
> Got code?
>
> On Mar 20, 2009, at 8:15 AM, Chirantan Kundu wrote:
>>
>> I'm trying to use the package termstrc. However I cannot figure out
>> how to invoke helper functions like create_cashflows_matrix &
>> create_maturities_matrix. Even when I try to invoke those with the
>> data supplied with the package (say, corpbonds), it throws error
>> saying "Error in as.vector(x, mode) : invalid 'mode' argument". Can
>> anybody provide some working example for these?
>> I'm on Windows XP and using R-2.7.2 + termstrc 1.1.
>>
>>
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

Visit us at http://www.2pirad.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to use termstrc functions?

2009-03-20 Thread Chirantan Kundu
Hi,

I'm trying to use the package termstrc. However I cannot figure out
how to invoke helper functions like create_cashflows_matrix &
create_maturities_matrix. Even when I try to invoke those with the
data supplied with the package (say, corpbonds), it throws error
saying "Error in as.vector(x, mode) : invalid 'mode' argument". Can
anybody provide some working example for these?
I'm on Windows XP and using R-2.7.2 + termstrc 1.1.

Thanks,
Chirantan

Visit us at http://www.2pirad.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.