Re: [R] Replacing 9999 and 999 values with NA

2015-02-21 Thread Frederic Ntirenganya
If you are reading the data frame using for instance read.csv, you can put in the argument na.string ="". Another way to do that is data[data ==] <- NA. It should be good to tell us how you are reading your dataset. On Feb 21, 2015 6:49 AM, "Jeff Newmiller" wrote: > You did not say how y

Re: [R] Correlation question

2015-02-21 Thread Jonathan Thayn
Of course! Thank you, I knew I was missing something painfully obvious. Its seems, then, that this line 1-sum((cars$dist-fitted.wrong)^2)/sum((cars$dist-mean(cars$dist))^2) is finding something other than the traditional correlation. I found this in a lecture introducing correlation, but , now,

Re: [R] multiple parameter optimization with optim()

2015-02-21 Thread Ravi Varadhan
Harold, Obviously the bottleneck is your objective function fn(). I have speeded up your function by a factor of about 2.4 by using `outer' instead of sapply. I think it can be speeded much more. I couldn't figure it out without spending a lot of time. I am sure someone on this list-serv

Re: [R] Correlation question

2015-02-21 Thread Kehl Dániel
Hi, try cor(fitted.right,fitted.wrong) should give 1 as both are a linear function of speed! Hence cor(cars$dist,fitted.right)^2 and cor(x=cars$dist,y=fitted.wrong)^2 must be the same. HTH d Feladó: R-help [r-help-boun...@r-project.org] ; meghatalmazó:

[R] Correlation question

2015-02-21 Thread Jonathan Thayn
I recently compared two different approaches to calculating the correlation of two variables, and I cannot explain the different results: data(cars) model <- lm(dist~speed,data=cars) coef(model) fitted.right <- model$fitted fitted.wrong <- -17+5*cars$speed When using the OLS fitted values, the

Re: [R] creating a distinct zip file

2015-02-21 Thread Jeff Newmiller
What is a "compiled zip"? There is a warning against using that term in section 1 of the Writing R Extensions documentation, along with a discussion of why it is ambiguous at best. Can you read that and clarify your statement? Since you make this assertion that R CMD INSTALL --build does not d

Re: [R] creating a distinct zip file

2015-02-21 Thread Duncan Murdoch
On 21/02/2015 2:47 PM, Erin Hodgess wrote: > I have Windows, but the "R CMD INSTALL --build pack" does not produce a > compiled zip. What does it do? Can you show us a transcript? Duncan Murdoch > > Thanks, > Erin > > > On Sat, Feb 21, 2015 at 1:49 PM, Peter Langfelder < > peter.langfel...@g

Re: [R] creating a distinct zip file

2015-02-21 Thread Erin Hodgess
I have Windows, but the "R CMD INSTALL --build pack" does not produce a compiled zip. Thanks, Erin On Sat, Feb 21, 2015 at 1:49 PM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Fri, Feb 20, 2015 at 6:56 PM, Rolf Turner > wrote: > > On 21/02/15 15:02, Jeff Newmiller wrote: > >> >

Re: [R] creating a distinct zip file

2015-02-21 Thread Peter Langfelder
On Fri, Feb 20, 2015 at 6:56 PM, Rolf Turner wrote: > On 21/02/15 15:02, Jeff Newmiller wrote: >> >> R CMD INSTALL --build packagename > > > That will create a *.tar.gz file, not a *.zip file. The latter being > what Erin wanted, if I understand correctly. It depends on her system (I don't see

Re: [R] creating a distinct zip file

2015-02-21 Thread peter dalgaard
> On 21 Feb 2015, at 18:01 , Erin Hodgess wrote: > > This is not for CRAN, just for someone else. > > > It doesn't need to be submitted. > As I understand it, it doesn't need to be submitted in order to be submitted... (to CRAN, winbuilder respectively). Just make sure it satisfies the for

Re: [R] creating a distinct zip file

2015-02-21 Thread Erin Hodgess
This is not for CRAN, just for someone else. It doesn't need to be submitted. Thanks, Erin On Sat, Feb 21, 2015 at 2:56 AM, Prof Brian Ripley wrote: > On 21/02/2015 07:31, Jeff Newmiller wrote: > >> On Windows it builds a zip file. If you are on Linux, you might [1] need >> [2]. >> >> [1] ht