Re: [R] Date issues

2010-09-18 Thread Henrik Bengtsson
Make sure to look at as.character(FnO_Data$Date[m:l]) My $.02 /Henrik On Sat, Sep 18, 2010 at 10:31 PM, Santosh Srinivas wrote: > I tried this and it works too (For most part) strangely for certain > dates (20090831) it is giving NA ... > >> FnO_Data$Date[m:l] >  [1] 20090828 20090828 200

Re: [R] Date issues

2010-09-18 Thread Santosh Srinivas
I tried this and it works too (For most part) strangely for certain dates (20090831) it is giving NA ... > FnO_Data$Date[m:l] [1] 20090828 20090828 20090828 20090828 20090828 20090828 20090828 20090828 20090828 20090828 20090828 20090828 [13] 20090828 20090828 20090828 20090828 20090828 2009

Re: [R] Repeating values in a list

2010-09-18 Thread Bill.Venables
> have <- list(a=7,b=3,c=1) > have2 <- lapply(have, rep, 2) > have2 $a [1] 7 7 $b [1] 3 3 $c [1] 1 1 > -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Derek Ogle Sent: Sunday, 19 September 2010 11:20 AM To: R (r-help@R-project.

[R] Arrrr.

2010-09-18 Thread Thomas Lumley
Ahoy maties, As I'm sure everyone is aware, today (ISOdate(2010,9,19)) is International Talk Like A Pirate Day. I hope Arrr-help and Arrr-devel, and the whole of the Arrr community will be observing the day properly. __ R-help@r-project.org mailin

Re: [R] adding variable to netCDF file

2010-09-18 Thread Peter Ehlers
On 2010-09-07 13:58, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote: I would like to open an existing netCDF file and add a variable to it. I am using the ncdf package. This test code gives the idea of what I am trying to do: library(ncdf) print('here we go') print('first, construct netCDF fi

Re: [R] glm: formula vs character

2010-09-18 Thread Thomas Lumley
On Fri, 17 Sep 2010, Greg Snow wrote: I think what is going on (and someone is likely to correct me otherwise) is that formulas have an associated environment that gets passed along with them while character strings do not. Yes. model.frame(), which is called from most modelling functions,

Re: [R] Repeating values in a list

2010-09-18 Thread Derek Ogle
Thanks to Dennis for solving my first question and also pointing me in the right direction. To complete the thread ... there are times when I need to have different numbers of repeats for each object in the list. This can be accomplished with mapply() as follows ... > mapply(rep,x=have,c(1,1,

Re: [R] Repeating values in a list

2010-09-18 Thread Dennis Murphy
Hi: How about > have <- list(a=7,b=3,c=1) > lapply(have, rep, 2) $a [1] 7 7 $b [1] 3 3 $c [1] 1 1 HTH, Dennis On Sat, Sep 18, 2010 at 6:19 PM, Derek Ogle wrote: > I have a list that looks like this ... > > > have <- list(a=7,b=3,c=1) > > have > $a > [1] 7 > > $b > [1] 3 > > $c > [1] 1 > >

[R] Repeating values in a list

2010-09-18 Thread Derek Ogle
I have a list that looks like this ... > have <- list(a=7,b=3,c=1) > have $a [1] 7 $b [1] 3 $c [1] 1 and I want to have a simple way to change it to the following without re-typing the values ... > desire <- list(a=c(7,7),b=c(3,3),c=c(1,1)) > desire $a [1] 7 7 $b [1] 3 3 $c [1] 1 1 In othe

Re: [R] one step just of cliff-- zero hessian matrix in optim, with reproducable code and data

2010-09-18 Thread Hey Sky
Dear Ravi thanks for your reply. I think the number of obs may do be the problem for a zero hessian matrix. since it is simulated data, I have increased the sample size to 500 obs and tried for around 20 times, the zero hessian did not appear, compared with the fact that it happens too often wi

Re: [R] Problems with "pdf" device using "plot" "glht" function on "multcomp" library.

2010-09-18 Thread Paul Johnson
Hi, Kenneth It is not clear if you mean that your pdf output usually works, but it does not in this special case, or that this is a first effort with pdf. The answer might depend on which is the case case. If you are just getting started, can I refer you to some lecture notes I made about saving

Re: [R] getting a function to do something

2010-09-18 Thread pdb
as, silly me. clearG() this now works! -- View this message in context: http://r.789695.n4.nabble.com/getting-a-function-to-do-something-tp2545594p2545596.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org maili

[R] getting a function to do something

2010-09-18 Thread pdb
Hi, I want to repeatedly do a task, so thought I could put it in a function and then just call the function. The task is just clearing all the graphics devices and then opening a new one of a specified size. Now, when I call the function below, nothing appears to happen. But when I run the 2 lin

[R] Saving long character variable to database saves timestamp instead

2010-09-18 Thread Mikkel Grum
When saving a data frame with long character variable, approximately longer than 3 characters, to a text field in PostgreSQL, using RODBC on Windows XP, I get a timestamp saved to the database instead. Is there any way to extend the number of characters that a text variable can receive? Here a

Re: [R] Preparing data frame for Plotrix kiteChart

2010-09-18 Thread Jim Lemon
On 09/18/2010 03:32 AM, Graham Smith wrote: ... What I am hoping for is: an x-axis labelled "Distance" with tick marks at 0, 5, 10,15,20 and 25. And, an y-axis labelled "Species" and tick marks labelled A, B and C. So I would appreciate some help on how the data should be prepared for kiteCha

[R] How to check conditional dependence

2010-09-18 Thread trekvana
Hello all- Lets say I have my dependent variable Y_ij and a time varying covariate X_ij. I want to formulate some regression model to check if X_ij is dependent on X_i1,X_i2,,X_i(j-1) and Y_i1,Y_i2,,Y_i(j-1). I want to test no dependence on the Y component. I'm thinking a simple linear r

Re: [R] feedback/question on function update()

2010-09-18 Thread Peter Ehlers
On 2010-09-18 13:14, Joshua Wiley wrote: Hello Ben, I believe the problem is not strictly update() in the for loop, but the formula being passed to update(). The value of "i" changes, but its symbol does not, so the second time through its like you overwrite the first. Here is one way around i

Re: [R] one step just of cliff-- zero hessian matrix in optim, with reproducable code and data

2010-09-18 Thread Ravi Varadhan
I was able to get proper convergence in "BFGS", when I use the starting value from Nelder-Mead with 5000 iterations. However, the hessian is not positive-definite. This indicates that you have a problem in your model. It seems to me that the model is over-parametrized. You have 20-odd parame

Re: [R] feedback/question on function update()

2010-09-18 Thread Joshua Wiley
Hello Ben, I believe the problem is not strictly update() in the for loop, but the formula being passed to update(). The value of "i" changes, but its symbol does not, so the second time through its like you overwrite the first. Here is one way around it that works for me: mdat <- matrix(c(1,2

[R] feedback/question on function update()

2010-09-18 Thread Benjamin Godlove
Hi, First let me say I am a big fan of R and appreciate all your time and effort. The update() function does not seem to work in a for loop. Consider the following: mdat <- matrix(c(1,2,3, 11,23,13, 12,4,8), nrow = 3, ncol=3, byrow=TRUE) reg <- lm(mdat[7:9]~1) for(i in 1:2) { reg <- update(reg,

Re: [R] Date issues

2010-09-18 Thread David Winsemius
On Sep 18, 2010, at 11:36 AM, David Winsemius wrote: On Sep 18, 2010, at 11:25 AM, Santosh Srinivas wrote: Strangely this is not working ... what am I doing wrong here? tDate <- FnO_Data$Date[1] tDate [1] 20090101 as.Date(c(tDate),format="%Y%m%d") [1] NA ?sasDate as.Date does not tak

Re: [R] Date issues

2010-09-18 Thread Santosh Srinivas
Thanks. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: 18 September 2010 21:07 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Date issues On Sep 18, 2010, at 11:25 AM, Santosh Srinivas wrote: > Strangely this is not working ... what am I

Re: [R] Date issues

2010-09-18 Thread Gabor Grothendieck
On Sat, Sep 18, 2010 at 11:25 AM, Santosh Srinivas wrote: > Strangely this is not working ... what am I doing wrong here? > >> tDate <- FnO_Data$Date[1] >> tDate > [1] 20090101 >> as.Date(c(tDate),format="%Y%m%d") > [1] NA > Do you have zoo loaded? If you do then a minimal reproducible example (

Re: [R] Date issues

2010-09-18 Thread Marc Schwartz
On Sep 18, 2010, at 10:25 AM, Santosh Srinivas wrote: > Strangely this is not working ... what am I doing wrong here? > >> tDate <- FnO_Data$Date[1] >> tDate > [1] 20090101 >> as.Date(c(tDate),format="%Y%m%d") > [1] NA What version of R are you running? What is the output of: str(FnO_Data$D

[R] one step just of cliff-- zero hessian matrix in optim, with reproducable code and data

2010-09-18 Thread Hey Sky
Hey, R Users a few days ago I have met a zero hessian with optim command. I reproduced it with simulated data. plz check the code and data at the bottom of the post. I also attachment them with this email. hope it can reduce some workload as copying and pasting. I have simunated data many time

Re: [R] Date issues

2010-09-18 Thread David Winsemius
On Sep 18, 2010, at 11:25 AM, Santosh Srinivas wrote: Strangely this is not working ... what am I doing wrong here? tDate <- FnO_Data$Date[1] tDate [1] 20090101 as.Date(c(tDate),format="%Y%m%d") [1] NA ?sasDate as.Date does not take numeric arguments. Try: > as.Date(as.character(tDate)

[R] Date issues

2010-09-18 Thread Santosh Srinivas
Strangely this is not working ... what am I doing wrong here? > tDate <- FnO_Data$Date[1] > tDate [1] 20090101 > as.Date(c(tDate),format="%Y%m%d") [1] NA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] How to check the available of a package on R repo

2010-09-18 Thread David Winsemius
On Sep 18, 2010, at 12:28 AM, Stephen Liu wrote: Hi Erik, I try to find out whether Emacs/ESS is available on R repo. What is its versiohn? There is no R repository that distributes Emacs. Emacs and the ESS package (for Emacs) are not part of R. You choose your version of Emacs and

Re: [R] post

2010-09-18 Thread Juliet Hannah
See if rowttests is any faster. library(genefilter) ?rowttests You have to install Bioconductor. I've used this on large datasets, but I haven't compared timings. On Mon, Sep 13, 2010 at 4:26 PM, Alexey Ush wrote: > Hello, > > I have a question regarding how to speed up the t.test on large dat

Re: [R] removing specific rows from array

2010-09-18 Thread Maas James Dr (MED)
Thanks Michael, Quite an effort! I failed to explain myself sufficiently clearly, what I need is for this if possible, to work with more than 4 treats, but still produce a matrix with all possible combinations of treatments (minus whichever treatment is in c1) in c2 and c3 but there would only

Re: [R] Odp: Programming: loop versus vector oriented

2010-09-18 Thread Jan private
Hello Petr, thank you for your ideas. The split() looks most realistic. What about this idea: 1. Define three functions Refun1, Refun2, Refun3 for the three different sections of the calculations (same as you suggested) 2. lambda = (Re <= 2320) * Refun1(Re) + ((Re > 2320) && (Re < 65 * dk)) *

Re: [R] R Founding

2010-09-18 Thread Tal Galili
Hello all, After many e-mails and comments, I made corrections to my post on the topic of R and funding. I hope this does a better service to the R community: http://www.r-statistics.com/2010/09/open-source-and-money-%E2%80%93-why-paying-r-developers-might-not-always-help-the-project/ Sorry for h

Re: [R] lmer() vs. lme() gave different variance component estimates

2010-09-18 Thread Peter Dalgaard
On 09/17/2010 10:50 PM, array chip wrote: > > > Thank you Peter. Actually 3 people from mixed model mailing list tried my > code > using lmer(). They got the same results as what I got from lme4(). So they > couldn't replicate my lmer() results: > > Random effects: > Groups NameVari