[R] evaluate one variable in an expression with two variables

2012-02-08 Thread moli
I want to evaluate f with the mean=7 mean=7 f <- expression(-(x-mean)^2/2) then get a new expression: -(x-7)^2/2 How could I do it? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/evaluate-one-variable-in-an-expression-with-two-variables-tp4370877p4370877.html Sent fr

[R] error in R CMD build when editing c function in R package

2012-01-31 Thread moli
I have modified a C function in the `phmm` package. Now I want to rebuild the package, but the following error occurred. How can I fix the error? $ cd ~/Desktop/phmmw $ R CMD build phmm * checking for file ‘phmm/DESCRIPTION’ ... OK * preparing ‘phmm’: * checking DESCRIPTION

Re: [R] formula error inside function

2012-01-25 Thread moli
Thanks for you help. I also spent a lot of time on it. Your explanation is very clear. -- View this message in context: http://r.789695.n4.nabble.com/formula-error-inside-function-tp4326549p4328117.html Sent from the R help mailing list archive at Nabble.com. _

[R] formula error inside function

2012-01-25 Thread moli
I want use survfit() and basehaz() inside a function, but it doesn't work. Could you take a look at this problem. Thanks for your help. Following is my codes: library(survival) n <- 50 # total sample size nclust <- 5 # number of clusters clusters <- rep(1:nclust,each=n/nclust) beta0 <- c(1,