Re: [R] test whether all elements of a vector are identical

2010-12-17 Thread Daniel Murphy
> all(vector[1]==vector) should be quick. [[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 pro

[R] Clark method enhancement to ChainLadder package

2010-11-13 Thread Daniel Murphy
d values, standard errors and CV's as on page 65 of the paper, and four residual plots. Type ?ClarkLDF and ?ClarkCapeCod for help on running Clark's two methods. Please contact the author, Daniel Murphy at chiefmurph _at_ yahoo.com, with questions, suggestions, ideas or problems. If anyon

[R] Tables in Packages

2010-08-17 Thread Daniel Murphy
I have a 100x2 matrix to go into a package. I could type it into the R code but, more generally, what is the *best* way to read a table from disk into, say, package 'foo' when it is loaded into memory via library(foo)? I thought of having .onLoad create an environment and assign a matrix read from

[R] Need help on date calculation

2010-07-12 Thread Daniel Murphy
If you want to use the mondate package you will need to specify the day of the month. Dates "March-2010" and "May-2010" are ambiguous. Recommend you choose last day of both months as "representative days." Then those days will be integer months apart. > a<-mondate("March 31, 2010", displayFormat="

Re: [R] S4-based package failure: setGeneric example#1

2010-04-19 Thread Daniel Murphy
Nevermind, I figured out my problem after looking at the packS4 package. I didn't realize that package.skeleton would build invalid R code. The warning hints at that, but I interpreted the warning to mean that the package.skeleton-generated code should be *edited*, and none of my edits gave me a w

[R] S4-based package failure: setGeneric example#1

2010-04-18 Thread Daniel Murphy
I am a newbie package builder who successfully built a "Hello world" package but am now having trouble building a package with S4 functionality. I thought I would start by building a package consisting of just the first example under the setGeneric help page in a "fresh" 2.10.0 (windows) console (m

[R] dmvnorm masked by emdbook

2010-03-13 Thread Daniel Murphy
I am using curve3d in the emdbook package to graph a gaussian copula density function generated via the copula package. Unfortunately, it appears that emdbook masks dmvnorm from the package mvtnorm in a way that prohibits copula from generating the gaussian copula. (Sounds very confusing!) For exam

[R] function by: order within subsets

2010-01-08 Thread Daniel Murphy
When the 'by' function forms subsets, are the rows in the same order as they are in the original data frame? For example, I want to use 'by' to calculate cumulative sums of a value 'v' by date 'd' for different levels of a factor 'f': > df<-data.frame(f=c("A","A","B"),d=as.Date(c("2010-1-1","2010