[R] how to analysisi spectrum of a dataset with NA value

2013-12-17 Thread Jie Tang
hi R users I have a large 1D dataset and some of them is NA value . I found I cound get the spectrum by such a command. ua=c£¨10£¬30 £¬40£¬50£¬NA£© spectrum(ua) and I could not use na.rm just like mean or sd function How could I get the spectrum of ua ? thank you . -- TANG Jie [[a

Re: [R] Help using mapply to run multiple models

2013-12-17 Thread David Winsemius
On Dec 17, 2013, at 5:53 PM, Simon Kiss wrote: > I think I'm missing something. I have a data frame that looks below. > sample.df<-data.frame(var1=rbinom(50, size=1, prob=0.5), var2=rbinom(50, > size=2, prob=0.5), var3=rbinom(50, size=3, prob=0.5), var4=rbinom(50, size=2, > prob=0.5), var5=r

[R] Help using mapply to run multiple models

2013-12-17 Thread Simon Kiss
I think I'm missing something. I have a data frame that looks below. sample.df<-data.frame(var1=rbinom(50, size=1, prob=0.5), var2=rbinom(50, size=2, prob=0.5), var3=rbinom(50, size=3, prob=0.5), var4=rbinom(50, size=2, prob=0.5), var5=rbinom(50, size=2, prob=0.5)) I'd like to run a series of

Re: [R] freetype 2.5.2, problem with the survival package, build R 2.15.x with gcc 4.8.x

2013-12-17 Thread Hin-Tak Leung
-- On Fri, Dec 13, 2013 16:29 GMT David Winsemius wrote: > >On Dec 11, 2013, at 7:30 PM, Hin-Tak Leung wrote: > >> Here is a rather long discussion etc about freetype 2.5.2, problem with the >> survival package, and build R 2.15.x with gcc 4.8.x. Please feel free to >

[R] estimating survival function from Cox model

2013-12-17 Thread array chip
Hi, I have some questions on how to estimate the survival function from a Cox model. I know how to do this in R using survfit(). But let's say the model was done is another software, and I was only given the estimate of baseline cumulative hazard "A0(t=10)" at the specified time "t=10" (basel

[R] estimating survival function from Cox model

2013-12-17 Thread array chip
Hi, I have some questions on how to estimate the survival function from a Cox model. I know how to do this in R using survfit(). But let's say the model was done is another software, and I was only given the estimate of baseline cumulative hazard "A0(t=10)" at the specified time "t=10" (basel

[R] estimating survival function from Cox model

2013-12-17 Thread array chip
Hi, I have some questions on how to estimate the survival function from a Cox model. I know how to do this in R using survfit(). But let's say the model was done is another software, and I was only given the estimate of baseline cumulative hazard "A0(t=10)" at the specified time "t=10" (basel

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
Dear Michael, have you tried the fullrange argument of stat_smooth? ggplot(SpaceShuttle, aes(x = Temperature, y = nFailures / trials)) + geom_point() + geom_smooth(method = "glm", family = binomial, aes(weight = trials), fullrange = TRUE) Best regrads, Thierry ___

Re: [R] Hello R user!

2013-12-17 Thread Jim Lemon
On 12/18/2013 04:33 AM, bibek sharma wrote: Hello R user, I have created two plots (attached!) using the codes below and would like to merge these figures in one. any suggestions are highly appreciated! Thanks, plot(graph1$yod,graph1$xod,data=graph1) dfx = data.frame(ev1=graph1$xod, ev2=graph1$

Re: [R] Problem to solve an integral equation

2013-12-17 Thread David Winsemius
On Dec 17, 2013, at 11:25 AM, Aurélien Philippot wrote: > thanks David for your answer. > > Sorry for the integrand; as you noticed, a parenthesis was missing. > Here is another integrand which is properly defined: > > integrand<- > function(C,x){-((500+10*x+1*max(0,x-50))^(-1)-(5

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Prof Brian Ripley
On 17/12/2013 22:02, Duncan Murdoch wrote: On 13-12-17 1:18 PM, Prof Brian Ripley wrote: The obvious idea to set up a local repository works. It takes 5 mins at most. That makes a lot of sense to do on Unix-alikes, but less so on Windows. A local repository of tarballs needs to be in src/co

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Prof J C Nash (U30A)
I actually agree with the sentiments below -- the optimizer should support its claims. The reality is sadly otherwise, in my view largely because of the difficulties in computing the Hessian. This exchange has been useful, as it highlights user expectations. Without such dialog, we won't improve o

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Duncan Murdoch
On 13-12-17 1:18 PM, Prof Brian Ripley wrote: The obvious idea to set up a local repository works. It takes 5 mins at most. That makes a lot of sense to do on Unix-alikes, but less so on Windows. A local repository of tarballs needs to be in src/contrib below the URL of the repository. On

Re: [R] Hello R user!

2013-12-17 Thread Christopher W Ryan
Here is a simple example (without the proportional size bubbles--you've been given some references on that) using the lattice package: # one dataframe holds the data from both "sources" I call them. # they would be data from your two separate dataframes, # that you call graph1 and graph2 dd <- dat

Re: [R] Problem to solve an integral equation

2013-12-17 Thread David Winsemius
On Dec 17, 2013, at 8:53 AM, Aurélien Philippot wrote: > Dear R experts, > > I am trying to find numerical solutions for an integral equation. > > > Here is an example: > > I started by defining the integrand, as a function of x and C, where x is > the variable of integration and C is the par

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Adelchi Azzalini
It was not my suggestion that an optimizer should check the Hessian on every occasion (this would be both time consuming and meaningless), but I expected it to do so before claiming that a point is at a minimum, that is, only for the candidate final point. Neither I have ever thought that n

Re: [R] Polychoric Principal Component Analysis (pPCA)

2013-12-17 Thread Peter Maclean
I have data set with binary responses. I would like to conduct polychoric principal component analysis (pPCA). I know there are several packages used in PCA but I could not find one that directly estimate pPCA and graph the individuals and variables maps. I will appreciate any help that expand t

[R] a better method than a long expression with many OR clauses

2013-12-17 Thread Christopher W Ryan
dd <- data.frame(longVariableName1=sample(1:4, 10, replace=TRUE), longVariableName2=sample(1:4, 10, replace=TRUE)) dd # define who is a case and who is not transform(dd, case=(longVariableName1==3 | longVariableName2==3)) But in reality I have 9 of those longVariableName variables, all of this pat

Re: [R] Query regarding solution of delay differential equations with distributed delay (volterra type)

2013-12-17 Thread David Winsemius
On Dec 17, 2013, at 7:14 AM, ghoshm ghosh wrote: > Dear R-user, > > Please let me know whether there is any package in R, which can solve delay > differential equations with distributed delay (volterra type). library(sos) findFn(volterra:) http://finzi.psych.upenn.edu/R/library/deSolve/html/ls

Re: [R] a better method than a long expression with many OR clauses

2013-12-17 Thread Steve Lianoglou
Hi Chris, (extra compelled to answer a Q from my undergrad alma mater :-) see below: On Tue, Dec 17, 2013 at 11:13 AM, Christopher W Ryan wrote: > dd <- data.frame(longVariableName1=sample(1:4, 10, replace=TRUE), > longVariableName2=sample(1:4, 10, replace=TRUE)) > dd > # define who is a case a

Re: [R] Time series and lm

2013-12-17 Thread William Dunlap
Use as.POSIXct instead of as.POSIXlt if you want to use lm() on the dates. (The data.frame() function makes this transformation for you, but you evaded data.frame() by adding the column with $<-(), which does not do the checks and transformations that data.frame() does.) Bill Dunlap Spotfire, TIBC

Re: [R] How to coerce an object name to character vector?

2013-12-17 Thread Greg Snow
Bert, Save some room in the stocks for me, If arguing against the use of 'assign' is worthy of being sent to the stocks then fortune(236) is probably enough evidence to put me next to you. To the original author, can you tell us more of what you are trying to accomplish? Replacement functions are

Re: [R] Hello R user!

2013-12-17 Thread Sarah Goslee
On Tue, Dec 17, 2013 at 1:04 PM, bibek sharma wrote: > Hi Sarah, > It is not about mfrow or mfcol. I would like to see both sets of data in > one figure. > All I want was combining these two plots to one. > Any suggestions? > Bibek Suggestions? Yes. Read the link I and others provided about rep

Re: [R] Problem to solve an integral equation

2013-12-17 Thread Aurélien Philippot
thanks David for your answer. Sorry for the integrand; as you noticed, a parenthesis was missing. Here is another integrand which is properly defined: integrand<- function(C,x){-((500+10*x+1*max(0,x-50))^(-1)-(500+10*x+C)^(-1))* 1/(x*0.20*sqrt(10)*sqrt(2*pi))*exp(-0.5*((log(x

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread Michael Friendly
Thanks very much for this helpful reply, Thierry Using aes(weight=trials) in stat_smooth() was part of what I was missing and solves my main question. However, for this data, I want to show the extrapolated prediction over a wider range than in the data. Adding xlim() doesn't help here-- the

[R] Time series and lm

2013-12-17 Thread Marlin Keith Cox
Hello all, I have a time series defined by chum$Time1<-as.POSIXlt(chum$Time, format= "%m/%d/%y %H:%M") and a measured parameter pa.s When I create a linear model with(chum.skin, lm(Time1~pa.s)) I get the following error. Error in model.frame.default(formula = Time1 ~ pa.s, drop.unused.levels

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Prof Brian Ripley
The obvious idea to set up a local repository works. It takes 5 mins at most. On 17/12/2013 18:08, Duncan Murdoch wrote: So apparently not as simple as I thought it would be. So I'll tell you what I actually do: I have a number of packages under development, some on CRAN, some not. I also wo

[R] RDCOMClient Help

2013-12-17 Thread Peter Quackenbush
Hello R Users, I apologize in advance if this question is in the wrong place, as my problem is not with the R Core system, but rather with RDCOMClient package. I am using a third-party modeling software tool that provides access to some functions via a *.dll file. Using COMCreate("ClassName") I c

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Ravi Varadhan
The optimization algorithms did converge to a limit point. But, not to a stationary point, i.e. a point in parameter space where the first and second order KKT conditions are satisfied. If you check the gradient at the solution, you will see that it is quite large in magnitude relative to 0.

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Duncan Murdoch
So apparently not as simple as I thought it would be. So I'll tell you what I actually do: I have a number of packages under development, some on CRAN, some not. I also work in multiple builds of R pretty frequently, so I like to install all my packages and commonly used ones from other peop

[R] Query regarding solution of delay differential equations with distributed delay (volterra type)

2013-12-17 Thread ghoshm ghosh
Dear R-user, Please let me know whether there is any package in R, which can solve delay differential equations with distributed delay (volterra type). Thanks and best regards, Mini Ghosh [[alternative HTML version deleted]] __ R-help@r-projec

Re: [R] Hello R user!

2013-12-17 Thread Sarah Goslee
What do you mean by "merge these figures in one"? If you want two figures on one page, see ?par - specifically mfrow and mfcol. If you want both sets of data in one figure, maybe ?points or ?lines though I see you're already familiar with at least ?lines. The list doesn't take most attachments, a

Re: [R] Hello R user!

2013-12-17 Thread Christopher W Ryan
What do you mean by "merge" them into one? Make both graphs appear on the same page of a document? Make a single figure containing both graphs? Plot data from both dataframes on the same set of axes? --Chris Ryan On Tue, Dec 17, 2013 at 12:33 PM, bibek sharma wrote: > Hello R user, > > I have

Re: [R] Hello R user!

2013-12-17 Thread John Kane
The plots did not arrive. The R-help list is fussy about what it allows to go through. Actually the best way of doing things is to use dput() to provide sample data. See https://github.com/hadley/devtools/wiki/Reproducibility or http://stackoverflow.com/questions/5963269/how-to-make-a-great-r

[R] Hello R user!

2013-12-17 Thread bibek sharma
Hello R user, I have created two plots (attached!) using the codes below and would like to merge these figures in one. any suggestions are highly appreciated! Thanks, plot(graph1$yod,graph1$xod,data=graph1) dfx = data.frame(ev1=graph1$xod, ev2=graph1$yod, ev3=abs(graph1$dif)) symbols(x=dfx$ev1, y

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Prof J C Nash (U30A)
As indicated, if optimizers check Hessians on every occasion, R would enrich all the computer manufacturers. In this case it is not too large a problem, so worth doing. However, for this problem, the Hessian is being evaluated by doing numerical approximations to second partial derivatives, so the

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Gábor Csárdi
> On Tue, Dec 17, 2013 at 11:36 AM, Duncan Murdoch > wrote: [...] >> I imagine some package has a function that does what you want, but I don't >> know it. It wouldn't be hard to put one together as follows: >> >> 1. install your package without its dependencies. This does not seem to work if t

Re: [R] barely readable "autocomplete" text

2013-12-17 Thread Sarah Goslee
Hi David, There are lots of places to get help for rkward, but this isn't one of them. Please try: http://sourceforge.net/apps/mediawiki/rkward/index.php?title=User_Documentation Sarah On Tue, Dec 17, 2013 at 11:59 AM, David Croll wrote: > > > Dear R users and R friends, > > > > > I have one

Re: [R] OdfWeave problem

2013-12-17 Thread John Kane
Thanks. As you will see from my reply I misread the manual and it shoud have been results = xml and I had tried XML. And result = 'asis' works too. I had thought it was unique to knitr and never thought to try it. Thanks John Kane Kingston ON Canada > -Original Message- > From: jdn

[R] barely readable "autocomplete" text

2013-12-17 Thread David Croll
Dear R users and R friends, I have one question I wish to have answered. I have RKWard installed on Ubuntu (12.04 LTS), and it works like a charm. The only problem is that the "autocomplete" function is barely readable. Here, you see the parameters of "scan()" written in white, on a sa

Re: [R] How to plug in characters as object names in a formula (recast from package reshape2 specifically)

2013-12-17 Thread Adams, Jean
Try this (untested code): recast(df, formula(paste(xvar, "~", yvar)), id.var=1:2, measure.var=3) Jean On Mon, Dec 16, 2013 at 9:11 AM, Jun Shen wrote: > Hi everyone, > > This may be very simple but I couldn't figure it out. I have this function > > rsm.lm<-function(data,xvar='xCmin',yvar='yCm

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Adelchi Azzalini
On Tue, 17 Dec 2013 15:21:57 +, Ravi Varadhan wrote: RV> The optimization algorithms did converge to a limit point. But, RV> not to a stationary point, i.e. a point in parameter space where RV> the first and second order KKT conditions are satisfied. If you RV> check the gradient at the solu

[R] Problem to solve an integral equation

2013-12-17 Thread Aurélien Philippot
Dear R experts, I am trying to find numerical solutions for an integral equation. Here is an example: I started by defining the integrand, as a function of x and C, where x is the variable of integration and C is the parameter I am interested in: integrand<- function(C,x){-((10*x)^(-1)-(1

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Gábor Csárdi
Thanks! Btw, install() from the devtools package can do this in theory, but not in practice, because of a bug (it silently ignores "Suggests"). This is fixed in their github version. Just to add something useful here. Gabor On Tue, Dec 17, 2013 at 11:36 AM, Duncan Murdoch wrote: > On 17/12/201

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Duncan Murdoch
On 17/12/2013 11:26 AM, Gábor Csárdi wrote: Dear all, I am trying to install a private package, with its dependencies. However, both install.packages("sand_1.0.tar.gz", dependencies=TRUE, repos=NULL, type="source") and install.packages("sand_1.0.tar.gz", dependencies="Suggests", repos=NULL, t

Re: [R] install.packages and dependencies=TRUE

2013-12-17 Thread Gábor Csárdi
Answer to myself. 'dependencies' are Not used if ‘repos = NULL’. Sorry for the noise. Gabor On Tue, Dec 17, 2013 at 11:26 AM, Gábor Csárdi wrote: > Dear all, > > I am trying to install a private package, with its dependencies. However, both > > install.packages("sand_1.0.tar.gz", dependencies=

Re: [R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Adelchi Azzalini
On Tue, 17 Dec 2013 08:27:36 -0500, Prof J C Nash (U30A) wrote: PJCN> If you run all methods in package optimx, you will see results PJCN> all over the western hemisphere. I suspect a problem with some PJCN> nasty computational issues. Possibly the replacement of the PJCN> function with Inf when a

Re: [R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread ONKELINX, Thierry
Dear Michael, Calculate the propotions. Then it is easy to use the weight option of glm data("SpaceShuttle", package="vcd") SpaceShuttle$trials <- 6 fm <- glm(cbind(nFailures, 6 - nFailures) ~ Temperature, data = SpaceShuttle, family = binomial) fm2 <- glm(nFailures/trials ~ Temperature, data =

[R] install.packages and dependencies=TRUE

2013-12-17 Thread Gábor Csárdi
Dear all, I am trying to install a private package, with its dependencies. However, both install.packages("sand_1.0.tar.gz", dependencies=TRUE, repos=NULL, type="source") and install.packages("sand_1.0.tar.gz", dependencies="Suggests", repos=NULL, type="source") fail to install suggested packa

Re: [R] OdfWeave problem

2013-12-17 Thread Jeff Newmiller
I, like Duncan have not used odfweave, but with knitr you would not use result=TRUE, rather you would use result='asis'. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] OdfWeave problem

2013-12-17 Thread Duncan Murdoch
On 17/12/2013 10:41 AM, John Kane wrote: Thanks Duncan. It sounds logical but neither seem to work. The code below and with output = gives the same result. <>= odfItemize(levels(iris$Species)) @ I am beginning to wonder if I have something wrong with my installation. I think it's an RTFM pr

Re: [R] OdfWeave problem

2013-12-17 Thread John Kane
Thanks Duncan. It sounds logical but neither seem to work. The code below and with output = gives the same result. <>= odfItemize(levels(iris$Species)) @ I am beginning to wonder if I have something wrong with my installation. The worst of this is I have not used odfWeave in at least a year a

Re: [R] OdfWeave problem

2013-12-17 Thread Duncan Murdoch
On 17/12/2013 10:00 AM, John Kane wrote: I am trying to get odfWeave to work and I seem to be doing something stupid. Straightforward inline statements and plain code chunks are working fine but when I try to use an actual odfWeave statement I get what appears to be the xml and not odt format.

[R] OdfWeave problem

2013-12-17 Thread John Kane
I am trying to get odfWeave to work and I seem to be doing something stupid. Straightforward inline statements and plain code chunks are working fine but when I try to use an actual odfWeave statement I get what appears to be the xml and not odt format. I am using Apache OpenOffice 3. 4.0. Sys

[R] ggplot2: stat_smooth for family=binomial with cbind(Y, N) formula

2013-12-17 Thread Michael Friendly
With ggplot2, I can plot the glm stat_smooth for binomial data when the response is binary or a two-level factor as follows: data("Donner", package="vcdExtra") ggplot(Donner, aes(age, survived)) + geom_point(position = position_jitter(height = 0.02, width = 0)) + stat_smooth(method = "glm", fami

[R] convergence=0 in optim and nlminb is real?

2013-12-17 Thread Prof J C Nash (U30A)
If you run all methods in package optimx, you will see results all over the western hemisphere. I suspect a problem with some nasty computational issues. Possibly the replacement of the function with Inf when any eigenvalues < 0 or nu < 0 is one source of this. Note that Hessian eigenvalues a

Re: [R] (no subject)

2013-12-17 Thread Rui Barradas
Hello, At an R prompt type ?lm Also, take a look at the file R-intro.pdf in your installation of R. Hope this helps, Rui Barradas Em 16-12-2013 10:31, Mahboobe Akhlaghi escreveu: > hello, > I have a project in dose response and I should fit some models on my data. > how can I fit linear and qu

Re: [R] (no subject)

2013-12-17 Thread PIKAL Petr
Hi ?lm but for dose response evaluation package drc is maybe more apropriate. Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Mahboobe Akhlaghi > Sent: Monday, December 16, 2013 11:31 AM > To: R-help@r-projec

Re: [R] unable to install XML package on Windows7

2013-12-17 Thread Prof Brian Ripley
Well, on Windows binary packages are available on CRAN. And get the source package from CRAN, not Omegahat. CRAN has had to apply corrections to get package XML to work on Windows. That said, http://www.omegahat.org/R/src/contrib/XML_3.98-1.tar.gz downloads and unpacks for me, so the problem

Re: [R] What is the formula of Pseudo-F statistic in capscale in vegan?

2013-12-17 Thread Jari Oksanen
Dear Kristen Ross, Kristen Ross gmail.com> writes: >tion; and (3) the R code used for this analysis. Sorry that I have to remove most of your original message: gmane won't allow me to post if I add too little compared to the cited text. This is now wild guessing, since there is nothing I wou

Re: [R] result

2013-12-17 Thread Jim Lemon
On 12/17/2013 05:50 PM, wrote: Mydata is as under. dat=" salary ex + 1 1856 1799 + 2 1856 1800 + 3 1858 1800 + 4 1858 1801 + 5 1862 1803 + 6 1862 1805 + 7 1862 1810 + 8 1865 1805 + 9 1865 1808 + 10 1865 1815 + 11 1865 1820 + 12 1870 1810 + 13 1870 1830 + 14 1880