[R] Question about legend parameters

2010-10-18 Thread Dimitri Liakhovitski
Hello! The code below works - if you run it you'll see a stacked area chart generated based on the data example. I only have one understanding question about the legend location (the very last snippet of code): legend(par()$usr[2], mean(par()$usr[3:4]), rev(order.of.vars), xpd=T, bty=n,

[R] Question about lme (mixed effects regression)

2010-10-18 Thread Dimitri Liakhovitski
, for Subject MO1: y(M01) = (17.71+1.25)+(0.66+0.106)*Age+(-1.66-1.52)*SexFemale = 18.96 + 0.766*Age -3.18*SexFemale Question: Is there an easier way to get such an equation for each level of Subject? Thank you very much! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] Question about lme (mixed effects regression)

2010-10-18 Thread Dimitri Liakhovitski
, e.g. graphs of coefficient shrinkage. So if this is the sort of thing you want to do with the BLUPS, you may not need to do it manually. HTH. Cheers, Bert On Mon, Oct 18, 2010 at 2:15 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! If I run this example: library

Re: [R] Question about lme (mixed effects regression)

2010-10-18 Thread Dimitri Liakhovitski
Gunter gunter.ber...@gene.com wrote: Oh -- I get your question (I think). Not the total, just the random effects. You have to add them to the fixed effects. See e.g. p. 39 of Bates and Pinheiro. -- Bert On Mon, Oct 18, 2010 at 3:00 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote

[R] simple function can't find weights

2010-10-20 Thread Dimitri Liakhovitski
(summary(regr.f)$adj.r.squared,3) results[nrow(results)+1,1]-round(dwtest(regr.f)$statistic,2) row.names(results)[(nrow(results)-2):nrow(results)]-c(R.Sqr, Adj.R.Sqr,DW) write.csv(results,file=file.name) return(results) } -- Dimitri Liakhovitski Ninah Consulting

[R] Initiating graphics recording in RGraphics window via a script

2010-10-20 Thread Dimitri Liakhovitski
, and then run my several graphs, e.g.: for(i in 10:12){ plot(1:i) } Is there any way to avoid doing it manually initiate the graphics recording in the RGraphics window in the script itself? Thanks a lot for your help! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] Initiating graphics recording in RGraphics window via a script

2010-10-20 Thread Dimitri Liakhovitski
, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

[R] rounding up (always)

2010-10-20 Thread Dimitri Liakhovitski
) floor(signif(x,3)+10) But it's very manual - because in the problem I am facing the numbers sometimes have to be rounded to a 1000, sometimes to a 100, etc. Thanks a lot for any hints! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R

Re: [R] rounding up (always)

2010-10-20 Thread Dimitri Liakhovitski
...@wlandres.net wrote: On 20-Oct-10 21:27:46, Duncan Murdoch wrote: On 20/10/2010 5:16 PM, Dimitri Liakhovitski wrote: Hello! I am trying to round the number always up - i.e., whatever the positive number is, I would like it to round it to the closest 10 that is higher than this number, the closest 100

Re: [R] rounding up (always)

2010-10-20 Thread Dimitri Liakhovitski
Thanks a lot, David - I'll try this solution. Dimitri On Wed, Oct 20, 2010 at 9:54 PM, David Winsemius dwinsem...@comcast.net wrote: On Oct 20, 2010, at 8:38 PM, Dimitri Liakhovitski wrote: Thank you for your help, everyone. Actually, I am building a lot of graphs (in a loop) but the values

[R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
defined inside the function? Thank you very much! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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

Re: [R] Odp: importing csv gets me all 16,000 columns with NA

2010-10-22 Thread Dimitri Liakhovitski
://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
. Look in the data frame 2. Look in the environment of the user-defined function 3. Look outside. Dimitri On Fri, Oct 22, 2010 at 9:15 AM, David Winsemius dwinsem...@comcast.net wrote: On Oct 22, 2010, at 9:01 AM, Dimitri Liakhovitski wrote: Dear R'ers, I am fighting with a problem

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
AM, David Winsemius dwinsem...@comcast.net wrote: On Oct 22, 2010, at 9:01 AM, Dimitri Liakhovitski wrote: Dear R'ers, I am fighting with a problem that is driving me crazy. I use lm in my user-defined function, but it seems to be looking for weights outside of my function's environment

[R] How long does skipping in read.table take

2010-10-22 Thread Dimitri Liakhovitski
(e.g., 1 milllion) using nrows= and skip. I was able to read in the first 1,000,000 rows no problem in 45 sec. But then I tried to skip 16,999,999 rows and then read in things. Then R crashed. Should I try again - or is it too many rows to skip for R? Thank you! -- Dimitri Liakhovitski Ninah

Re: [R] How long does skipping in read.table take

2010-10-22 Thread Dimitri Liakhovitski
a lot! Dimitri On Fri, Oct 22, 2010 at 6:28 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Oct 22, 2010 at 5:17 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I know I could figure it out empirically - but maybe based on your experience you can tell me if it's doable

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
Grothendieck ggrothendi...@gmail.com wrote: On Fri, Oct 22, 2010 at 9:45 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Gabor, thanks a lot - sqldf might be a solution. However, do you know if sqldf can also read in .txt files (with different delimiters)? The data I am dealing

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
Grothendieck ggrothendi...@gmail.com wrote: On Sat, Oct 23, 2010 at 9:20 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: This is very helpful, Gabor. I've run the code to figure out the end of the line and here is what I am seeing at the end of each line: \r\n So, I specified like

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
:44 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Oh, I understand - I did not realize it's reading in the whole file. So, is there any way to make it read it in only once and the spit into R just one piece (e.g., 1 million rows), write a regular file out (e.g., a txt using

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
O, wait a sec - does it mean I can't feed my objects into sql commands? On Sat, Oct 23, 2010 at 10:07 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I just tried it: for(i in 11:16){ #i-11  start-Sys.time()  print(start)  flush.console()  filename-paste(skipped millions- ,i

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
-bit Windows 7 PC with 6 GB RAM (I assume only 4 can be used?)) I got this error: Error: cannot allocate vector of size 42.0 Mb So, I guess On Sat, Oct 23, 2010 at 10:19 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sat, Oct 23, 2010 at 10:07 AM, Dimitri Liakhovitski dimitri.liakhovit

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
,.txt,sep=) write.table(DF,sep=\t,header=FALSE,file=filename) count-count+1 } close(con) On Sat, Oct 23, 2010 at 10:19 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Sat, Oct 23, 2010 at 10:07 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I just tried it: for(i

Re: [R] How long does skipping in read.table take

2010-10-23 Thread Dimitri Liakhovitski
Also am running the same code on my powerful home PC. It's been running for 25 minutes already, and still has not printed the first end time (does it mean it's still trying to read in DF for the first time)? On Sat, Oct 23, 2010 at 10:52 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com

[R] finding the year of a date

2010-10-25 Thread Dimitri Liakhovitski
I know that I can use as.yearmon in the package zoo to find the year and the month of a date. I can use as. yearqtr to find the year and the quarter. But how can one find just the year of a date? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] finding the year of a date

2010-10-25 Thread Dimitri Liakhovitski
Thank you very much! Dimitri On Mon, Oct 25, 2010 at 12:46 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, Oct 25, 2010 at 12:38 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I know that I can use as.yearmon in the package zoo to find the year and the month

[R] mixed effects regression with weights using lme (lme4)

2010-10-26 Thread Dimitri Liakhovitski
Hello! I am sorry if it's a naive/wrong question. But can one run a regression with weights using lme? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] mixed effects regression with weights using lme (lme4)

2010-10-26 Thread Dimitri Liakhovitski
are specified the same way as in the lm function, and refers you to ?lm for details. HTH, Ista On Tue, Oct 26, 2010 at 11:21 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I am sorry if it's a naive/wrong question. But can one run a regression with weights using lme

[R] lme vs. lmer results

2010-10-26 Thread Dimitri Liakhovitski
appreciate a clarification! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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 provide

Re: [R] lme vs. lmer results

2010-10-26 Thread Dimitri Liakhovitski
...@stat.wisc.edu wrote: On Tue, Oct 26, 2010 at 12:27 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello, and sorry for asking a question without the data - hope it can still be answered: I've run two things on the same data: # Using lme: mix.lme - lme(DV ~a+b+c+d+e+f+h+i

[R] correctness of a formula in lme (from package nlme)

2010-10-27 Thread Dimitri Liakhovitski
| Subject) summary(fm1) ranef(fm1) When I run it like this I do get fixed effects in summary(my.model) and I do get random coefficients by group (in my example - by Subject) in ranef(fm1). I just want to make sure it's what I want. Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

[R] help pages do not open

2010-10-29 Thread Dimitri Liakhovitski
and installed R12 instead. But I am getting the same error. Any advice? -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] help pages do not open

2010-10-29 Thread Dimitri Liakhovitski
, Oct 29, 2010 at 9:22 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I have just installed R-2.12 I have Windows 7, 64-bit verison. I currently have IE as my default browser. The internet connection is very good. Whenever I try to run a help command (?lm, for example), I get

Re: [R] help pages do not open

2010-10-29 Thread Dimitri Liakhovitski
Problem solved. It turned out I had to reset my IE as my default browser for all extentions (like .html). Now, R help is working! Dimitri On Fri, Oct 29, 2010 at 4:20 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I tried one more thing - I uninstalled R again, and this time

[R] R version 2-12.0 - running as 32 or as 64 bit?

2010-10-29 Thread Dimitri Liakhovitski
Question: I installed R verison 2-12.0 on my Windows 7 (64 bit) PC. When I was installing it, it did not ask me anything about 32 vs. 64 bit. So, if I run R now - is it running as a 32-bit or a 64-bit? thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] R version 2-12.0 - running as 32 or as 64 bit?

2010-10-29 Thread Dimitri Liakhovitski
wrote: G'day Dimitri, On Fri, 29 Oct 2010 16:45:00 -0400 Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Question: I installed R verison 2-12.0 on my Windows 7 (64 bit) PC. When I was installing it, it did not ask me anything about 32 vs. 64 bit. So, if I run R now - is it running

Re: [R] summary.lm for post-hoc tests

2010-10-30 Thread Dimitri Liakhovitski
-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] summary.lm as a post-hoc test?

2010-10-30 Thread Dimitri Liakhovitski
PM, Dimitri Liakhovitski wrote: You are asking a statistics question, not an R question. R-list people never react to such posts. Or they give you a nasty reply of the type: Do you homework first, and then ask questions here. Good point. I thought it was an R question because it was about

[R] stacking effectively - without loops

2010-11-02 Thread Dimitri Liakhovitski
Hello! I have 2 vectors: x-letters[1:5] y-1:3 Is there a way - without loops - to create a data frame such that we repeat the whole y within each level of x so that it looks like this: a 1 a 2 a 3 b 1 b 2 b 3 c 1 c 2 c 3 etc? Thank you! -- Dimitri Liakhovitski Ninah Consulting

Re: [R] stacking effectively - without loops

2010-11-02 Thread Dimitri Liakhovitski
Never mind - found it: expand.grid(y,x) On Tue, Nov 2, 2010 at 4:57 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have 2 vectors: x-letters[1:5] y-1:3 Is there a way - without loops - to create a data frame such that we repeat the whole y within each level of x

[R] avoiding too many loops - reshaping data

2010-11-03 Thread Dimitri Liakhovitski
it. Thanks a lot for your hints! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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

Re: [R] avoiding too many loops - reshaping data

2010-11-03 Thread Dimitri Liakhovitski
this:  xtabs(value ~ city + brand, mydf) On Wed, Nov 3, 2010 at 6:23 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have a data frame like this one: mydf-data.frame(city=c(a,a,a,a,a,a,a,a,b,b,b,b,b,b,b,b),  brand=c(x,x,y,y,z,z,z,z,x,x,x,y,y,y,z,z),  value=c

Re: [R] avoiding too many loops - reshaping data

2010-11-03 Thread Dimitri Liakhovitski
In reshape2 this does the job: dcast(mydf,city~brand,sum) On Wed, Nov 3, 2010 at 4:37 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thanks a lot! Yes - I just found the reshape package too - and guess what, my math was wrong! reshape2 seems like the more up-to-date

Re: [R] avoiding too many loops - reshaping data

2010-11-03 Thread Dimitri Liakhovitski
Want to thank everyone once more for pointing in reshape direction. Saved me about 16 hours of looping! Dimitri On Wed, Nov 3, 2010 at 4:38 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: In reshape2 this does the job: dcast(mydf,city~brand,sum) On Wed, Nov 3, 2010 at 4:37 PM

[R] biding rows while merging at the same time

2010-11-03 Thread Dimitri Liakhovitski
a b c d loc 1 1/1/2010 1 11 111 NA loc 2 1/1/2010 2 12 112 NA loc 3 1/1/2010 3 13 113 NA loc 1 2/1/2010 3 NA 114 1 loc 2 2/1/2010 5 NA 115 11 loc 3 2/1/2010 6 NA 116 111 Thanks a lot for your suggestions! -- Dimitri Liakhovitski Ninah

Re: [R] biding rows while merging at the same time

2010-11-03 Thread Dimitri Liakhovitski
Never mind - I found it in reshape package: rbind.fill I wonder if it's still in reshape2. Dimitri On Wed, Nov 3, 2010 at 5:34 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have 2 data frames like this (well, actually, I have 200 of them): df1-data.frame(location=c

Re: [R] avoiding too many loops - reshaping data

2010-11-03 Thread Dimitri Liakhovitski
On Wed, Nov 3, 2010 at 4:32 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this:  xtabs(value ~ city + brand, mydf) On Wed, Nov 3, 2010 at 6:23 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have a data frame like this one: mydf-data.frame(city=c

[R] lookup in R - possible to avoid loops?

2010-11-08 Thread Dimitri Liakhovitski
it for hundreds and hundreds of names in 100 of huge files (tens of thousands of rows in each). Any way to speed it up? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] lookup in R - possible to avoid loops?

2010-11-08 Thread Dimitri Liakhovitski
the lookup table, and my.df$category = categories[my.df$names] creates the category column.                                           - Phil On Mon, 8 Nov 2010, Dimitri Liakhovitski wrote: Hello! Hope there is a nifty way to speed up my code by avoiding loops. My task is simple - analogous

[R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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 provide commented, minimal, self

[R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
) : cannot open the connection Question: I'd like to program an if-then statement in my code that says something like this: myfile-read.csv(myfilename) if cannot open the connection - then do X What statement should I use under if? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
- data.frame(a = 1, b = 2, c = i)  if (i == 1) {    y - x  } else {    y - merge(x, y, all.x = TRUE, all.y = TRUE)  } } On Tue, Nov 9, 2010 at 8:42 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I am running a loop. The result of each run of the loop is a data frame

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
Thanks a lot, everybody- it's very helpful! On Tue, Nov 9, 2010 at 12:20 PM, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Dimitri Liakhovitski Sent: Tuesday, November 09

[R] replaing 1-digit months with 2-digit months in a date

2010-11-09 Thread Dimitri Liakhovitski
! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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 provide commented, minimal, self

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
                                        spec...@stat.berkeley.edu On Tue, 9 Nov 2010, Dimitri Liakhovitski wrote: Hello! I am running a loop. The result of each run of the loop is a data frame. I am merging all the data frames. For exampe: The dataframe from run 1: x-data.frame(a=1,b=2,c=3

Re: [R] replaing 1-digit months with 2-digit months in a date

2010-11-09 Thread Dimitri Liakhovitski
On Tue, Nov 9, 2010 at 12:30 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this: gsub(\\.(\\d{1}$), .0\\1, x) On Tue, Nov 9, 2010 at 3:28 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello again! Sorry, if it's a simple question - I am very bad in working

Re: [R] distributing a value for a given month across the number of weeks in that month

2010-07-13 Thread Dimitri Liakhovitski
...@gmail.com wrote: On Fri, Jul 9, 2010 at 9:35 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! Any hint would be greatly appreciated. I have a data frame that contains (a) monthly dates and (b) a value that corresponds to each month - see the data frame monthly below

Re: [R] distributing a value for a given month across the number of weeks in that month

2010-07-13 Thread Dimitri Liakhovitski
Thank you very much, Gabor! Dimitri On Tue, Jul 13, 2010 at 12:25 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Tue, Jul 13, 2010 at 11:19 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Actually, I realized that my task was a bit more complicated as I have different

[R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
- cbind(DV, lag(DV, 2))[idx,] out-cbind(x, DVs[,2]) names(out)[length(out)]-DV.lead return(out) } A A.lead - do.call(rbind, by(A, A$group, lead.it)) A.lead -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list

Re: [R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
Never mind- I figured it out: A library(zoo) z - read.zoo(A, index = 1, split = group, frequency = 1) z - as.zooreg(z) ### result-lag(z, c(-1, 0, 1)) A result Thank you very much! On Wed, Jul 21, 2010 at 12:08 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you, Gabor

Re: [R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
21, 2010 at 12:12 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Never mind- I figured it out: A library(zoo) z - read.zoo(A, index = 1, split = group, frequency = 1) z - as.zooreg(z) ### result-lag(z, c(-1, 0, 1)) A result Thank you very much! On Wed, Jul 21, 2010 at 12

Re: [R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
(out)]-DV.lag return(out) } A A.lagged - do.call(rbind, by(A, A$group, lag.it)) A.lagged On Wed, Jul 21, 2010 at 12:18 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Sorry, I don't think it's working. the last 3 columns (on the right) of result contain the original data

Re: [R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
I reinstalled zoo and now I can see the years on left (raw names). Before - I could not see them. Thank you! On Wed, Jul 21, 2010 at 12:51 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Wed, Jul 21, 2010 at 12:18 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Sorry, I

Re: [R] The opposite of lag

2010-07-21 Thread Dimitri Liakhovitski
Thanks a lot, it's very helpful! On Wed, Jul 21, 2010 at 1:21 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Wed, Jul 21, 2010 at 1:16 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I reinstalled zoo and now I can see the years on left (raw names). Before - I could

[R] does package QuantPsych function lm.beta can handle results of a regression with weights?

2010-07-22 Thread Dimitri Liakhovitski
that just gives me the standardized regression weights - even if I used weights for regression? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] Error produced by read.zoo: bad entries

2010-07-23 Thread Dimitri Liakhovitski
Hello! I have a data set similar to the data set monthly in the example below: monthly-data.frame(month=c(20090301,20090401,20090501,20100301,20100401,20090301,20090401,20090501,20100301,20100401),monthly.value=c(100,200,300,101,201,10,20,30,11,21),market=c(Market A,Market A, Market A,Market A,

Re: [R] Error produced by read.zoo: bad entries

2010-07-23 Thread Dimitri Liakhovitski
= 1 nor split =2 work. And split =Brand does not work either. Why? D. On Fri, Jul 23, 2010 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: ?read.zoo You didn't specify the index column correctly. On Jul 23, 2010, at 12:36 PM, Dimitri Liakhovitski wrote: Hello! I have a data set

Re: [R] Error produced by read.zoo: bad entries

2010-07-23 Thread Dimitri Liakhovitski
. On Jul 23, 2010, at 1:01 PM, Dimitri Liakhovitski wrote: Strange, I did attach. Attaching again. Maybe the file just doesn't go through? I have: names(OrigData): [1] Brand Month Value I read ?read.zoo According to that index should be the column number. I thought it should be split = 1

Re: [R] Error produced by read.zoo: bad entries

2010-07-23 Thread Dimitri Liakhovitski
...@comcast.net wrote: On Jul 23, 2010, at 1:39 PM, Dimitri Liakhovitski wrote: Very sorry - I mistunderstood and confused split with index.column - totally my fault. Ok, now I've run this line: z - read.zoo(OrigData, index.column = 2, split = Brand) And I am getting: Error in merge.zoo

Re: [R] Error produced by read.zoo: bad entries

2010-07-23 Thread Dimitri Liakhovitski
how to best save dates in Excel if one saves them as .csv. Dimitri On Fri, Jul 23, 2010 at 2:00 PM, David Winsemius dwinsem...@comcast.net wrote: On Jul 23, 2010, at 1:50 PM, Dimitri Liakhovitski wrote: I am expecting to see the week names as row labels of z and the corresponding values (like

Re: [R] does package QuantPsych function lm.beta can handle resultsof a regression with weights?

2010-07-29 Thread Dimitri Liakhovitski
])    beta - b * sx/sy    return(beta) } The above should do the trick. TF -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Liakhovitski Sent: Thursday, July 22, 2010 12:35 PM To: r-help@r-project.org Subject: [R] does

Re: [R] reading dates in Excel into R

2010-07-30 Thread Dimitri Liakhovitski
-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 provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

[R] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
the question: my PC's memory is X. The .txt tab-delimited file I am trying to read in has the size of YYY Mb, can I read it in? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https

Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
Thanks a lot, it's very helpful! Dimitri On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 03/08/2010 1:10 PM, Dimitri Liakhovitski wrote: I understand the question I am about to ask is rather vague and depends on the task and my PC memory. However, I'll give

Re: [R] limits of a data frame size for reading into R

2010-08-03 Thread Dimitri Liakhovitski
And once one above the limit that Jim indicated - is there anything one can do? Thank you! Dimitri On Tue, Aug 3, 2010 at 2:12 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thanks a lot, it's very helpful! Dimitri On Tue, Aug 3, 2010 at 1:53 PM, Duncan Murdoch murdoch.dun

[R] converting monthly to weekly without changing the original values

2010-08-04 Thread Dimitri Liakhovitski
as it currently does? 2. In addition to 1, how can I ask zoo to actually keep the original (monthly) values in each week of that month - rather than divide the monthly value by the number of weeks? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] converting monthly to weekly without changing the original values

2010-08-04 Thread Dimitri Liakhovitski
, as.yearmon(mondays), function(x) zoo(x, rownames(x Dimitri On Wed, Aug 4, 2010 at 12:36 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have a code for converting monthly values into weekly values: monthly-data.frame(month=c

[R] applying strsplit to a whole column

2010-08-04 Thread Dimitri Liakhovitski
- without using a loop. I hope it's possible to do it without a loop - is it? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] applying strsplit to a whole column

2010-08-04 Thread Dimitri Liakhovitski
Thank you very much, everyone! Dimitri On Wed, Aug 4, 2010 at 2:10 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 1:42 PM, Dimitri Liakhovitski wrote: I am sorry, I'd like to split my column (names) such that all the beginning of a string (X..) is gone and only the rest

Re: [R] applying strsplit to a whole column

2010-08-04 Thread Dimitri Liakhovitski
=FALSE) str(x) strsplit(x[[1]],split=\\..) str(strsplit(x[[1]],split=\\..)) I am getting a list - hence, it looks like I have to go in a loop...? Thank you! Dimitri On Wed, Aug 4, 2010 at 2:39 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you very much, everyone! Dimitri

Re: [R] applying strsplit to a whole column

2010-08-04 Thread Dimitri Liakhovitski
exactly does the square bracket in your lapply code mean? Looks like a shortcut - I've not seen it before. lapply( strsplit(z[[1]],split=\\..), [, 1) Thank you! Dimitri On Wed, Aug 4, 2010 at 3:31 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 3:03 PM, Dimitri Liakhovitski

[R] transforming dates into years

2010-08-13 Thread Dimitri Liakhovitski
- like as.yearmon - but for years? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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

Re: [R] reading a text file, one line at a time

2010-08-15 Thread Dimitri Liakhovitski
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] stacked area chart

2010-09-27 Thread Dimitri Liakhovitski
- for y (above z) - they'll be below zero ### and above zero we'll have a first and x second (on top of a). Thanks a lot for your advice! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] stacked area chart

2010-09-27 Thread Dimitri Liakhovitski
){ top.line.coords-bottom.y.coordinates+my.data[[var]] bottom.coords-c(bottom.y.coordinates,rev(top.line.coords)) polygon(xx,bottom.coords,col=all.colors[which(names(my.data) %in% var)]) bottom.y.coordinates-top.line.coords } On Mon, Sep 27, 2010 at 11:47 AM, Dimitri Liakhovitski

Re: [R] stacked area chart

2010-09-28 Thread Dimitri Liakhovitski
$Date), labels=unique(my.data.m$date)) +  scale_fill_manual(values=c(yellow, blue, green, orange)) +  theme_bw() +  ylab(Title of Y) +  opts(title=Chart title, axis.text.x=theme_text(angle=70, vjust=1, hjust=1)) HTH, Ista On Mon, Sep 27, 2010 at 6:05 PM, Dimitri Liakhovitski

[R] Question about Reduce

2010-10-01 Thread Dimitri Liakhovitski
0.9145508 [19] 8.4572754 9.2286377 14.6143188 Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

[R] Suppressing printing in the function

2010-10-01 Thread Dimitri Liakhovitski
Hello! I wrote a function that returns a data frame. Nowhere in the function do I say print(my.data.frame), but when I run the function - the data frame is printed on the console. Is there any way to suppress it? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] Suppressing printing in the function

2010-10-01 Thread Dimitri Liakhovitski
                                        Department of Statistics                                         UC Berkeley                                         spec...@stat.berkeley.edu On Fri, 1 Oct 2010, Dimitri Liakhovitski wrote: Hello! I wrote a function that returns a data frame. Nowhere in the function do I say

[R] reducing distances between tickmarks

2010-10-04 Thread Dimitri Liakhovitski
(top.line.coords)) polygon(xx,bottom.coords,col=all.colors[which(names(my.data) %in% var)]) bottom.y.coordinates-top.line.coords } grid(nx=NULL,ny=NULL,col = lightgray, lty = dotted,lwd = par(lwd)) axis(1, las = 2) -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

Re: [R] reducing distances between tickmarks

2010-10-04 Thread Dimitri Liakhovitski
=0.7) grid(nx=(length(my.data$date)-1),ny=NULL,col = lightgray, lty = dotted,lwd = par(lwd)) Dimitri On Mon, Oct 4, 2010 at 3:56 PM, David Winsemius dwinsem...@comcast.net wrote: On Oct 4, 2010, at 3:28 PM, Dimitri Liakhovitski wrote: Hello, everybody! I have a code below that creates a data

[R] adding a legend to the plot (but outside of it)

2010-10-04 Thread Dimitri Liakhovitski
-01), %Y-%m-%d), at=my.data$date, las=2,cex.axis=0.7) grid(nx=(length(my.data$date)-1),ny=NULL,col = lightgray, lty = dotted,lwd = par(lwd)) -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Ridge regression and mixed models

2010-10-04 Thread Dimitri Liakhovitski
]] __ 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 provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski Ninah

[R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ 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 provide commented, minimal, self

Re: [R] R doesn't want to update packages (Windows 7)

2010-10-05 Thread Dimitri Liakhovitski
Thnaks a lot, Duncan! Running R as administrator solved the problem! Dimitri On Tue, Oct 5, 2010 at 9:07 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:  On 05/10/2010 8:58 AM, Dimitri Liakhovitski wrote: Hello! I've just installed R 2.11.1 on my new home PC. Just the base R. My PC has

Re: [R] adding a legend to the plot (but outside of it)

2010-10-05 Thread Dimitri Liakhovitski
)])        bottom.y.coordinates-top.line.coords } axis(1, labels =format(as.Date(my.data$date, origin=1970-01-01), %Y-%m-%d), at=my.data$date, las=2,cex.axis=0.7) grid(nx=(length(my.data$date)-1),ny=NULL,col = lightgray, lty = dotted,lwd = par(lwd)) -- Dimitri Liakhovitski Ninah Consulting www.ninah.com

[R] is there a way to avoid traveling grid?

2010-10-05 Thread Dimitri Liakhovitski
Hello! If you run the whole code below, it'll produce a stacked diagram. And it looks good - because the tick-marks are aligned with the grid. However, if I stretch the graph window, grid becomes misaligned with the tickmarks. Or, rather, it seems aligned for the first and the last tick mark, but

Re: [R] adding a legend to the plot (but outside of it)

2010-10-05 Thread Dimitri Liakhovitski
),   xpd=T,   bty=n,   pch=15,   col=all.colors) Hope that helps. -tgs On Tue, Oct 5, 2010 at 10:33 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thanks a lot, Thomas. May I ask 2 questions: 1. Is there a way to fill the legend rectangles with color (currently, they just

Re: [R] is there a way to avoid traveling grid?

2010-10-05 Thread Dimitri Liakhovitski
Barry - thanks a lot, it's great. Now, the gridlines stick to the tick marks! Just wondering why the product of grid does not. D. On Tue, Oct 5, 2010 at 11:07 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Tue, Oct 5, 2010 at 3:37 PM, Dimitri Liakhovitski dimitri.liakhovit

[R] reshape not using as id vars what it is supposed to be using?

2010-10-05 Thread Dimitri Liakhovitski
as a measured variable, while it should be clear to reshape that time is NOT a measured variable? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] is there a way to avoid traveling grid?

2010-10-05 Thread Dimitri Liakhovitski
-project.org [mailto:r-help-boun...@r-project.org] Namens Dimitri Liakhovitski Verzonden: dinsdag 5 oktober 2010 16:37 Aan: r-help@r-project.org Onderwerp: [R] is there a way to avoid traveling grid? Hello! If you run the whole code below, it'll produce a stacked diagram. And it looks good

  1   2   3   4   5   6   7   >