Re: [R] color2D.matplot not giving colors

2010-03-07 Thread Jim Lemon
On 03/07/2010 05:23 AM, david hilton shanabrook wrote: I am using color2D.matplot to plot a matrix about 400 by 200. The values in the matrix are 0:5 and NA. The resulting plot is not color, but shaded b/w. I tried to figure out how to add colors, I would like something like c(blue, green, r

Re: [R] Unsigned Posts; Was Setting graphical parameters

2010-03-07 Thread Peter Dalgaard
Jim Lemon wrote: I think Rolf's guess about the provenance of the request was based upon the carefully copied format, which Blind Freddie could see was homework (and the requester actually admitted it!). Personally, I never answer requests that have the due date for the assignment at the botto

Re: [R] Unsigned Posts; Was Setting graphical parameters

2010-03-07 Thread Peter Dalgaard
Peter Dalgaard wrote: (Notice, BTW, that I too have taken to sending mailing lists via Gmail. Nothing to do with hiding my identity, but I'm now working behind an Exchange server, and those beasts won't do server-side filtering, so webmail would be a pain if regular mail got mixed with r-help

Re: [R] Writing own simulation function in C

2010-03-07 Thread Romain Francois
On 03/06/2010 05:51 AM, Sharpie wrote: TheSavageSam wrote: I am wishing to write my own random distribution simulation function using C programmin language(for speed) via R. I am familiar with R programming but somewhat new to C programming. I was trying to understand "Writing R extensions" -gu

[R] OT: stats challege

2010-03-07 Thread Jim Lemon
Hi all, Just letting you know about another challenge that might interest someone on the list. http://click.email.innocentive.com/?ju=fe5e1d71756c07787412&ls=fe0417717764067b711d7075&m=fef91270706102&l=fe8815797c62037d72&s=fe1e16787c640d797c1371&jb=ffcf14&t= Predictive Data Analysis (#923157

[R] help using ecm.mix

2010-03-07 Thread Andreas Wittmann
Dear R-users, i have the following exmple for which i want to use ecm.mix from the mix-package. with da.mix after using em.mix i get the error "improper posterior--empty cells", which is not uncommen because of 17 * 5 * 3 = 255 cells. so the next attempt is to use the ecm.mix for the restric

[R] Why can't "apply" be used with "as.factor" on a data.frame ?

2010-03-07 Thread Tal Galili
Hi all, Let's say I have a data.frame and wants to turn each of it's columns into a factor. My instinct would be to use as.factor with apply. But this won't work, and result with a data.frame of characters. I found another solution for how to achieve this, but I would also like to understand - *WH

[R] xyplot: strip size

2010-03-07 Thread Hadassa Brunschwig
Hi, I was wondering if there is a way to control the strip size in xyplot for example using the strip.default function. Or do I need to redraw the strips by myself? I would like to make the strip slimmer and I have reduced the font size using cex. However, I don't know how to change the size of t

Re: [R] Unsigned Posts; Was Setting graphical parameters

2010-03-07 Thread Barry Rowlingson
On Thu, Mar 4, 2010 at 11:47 PM, Jim Lemon wrote: > I had a working hypothesis about this, but decided to check the data before > replying. Looking at the ten most recent obvious pseudonyms, all were from > free email accounts like gmail or yahoo. A few of these included all or part > of the name

[R] questions about "Cusum"

2010-03-07 Thread sdzhangping
Dear friends: I have just read an article entitled " Monitoring of nosocomial invasive aspergillosis and early evidence of an outbreak using cumulative sum tests (CUSUM)", which is published in "Clinical Microbiology and Infection". We have great need to estimate the fluctuation of incidence

Re: [R] Why can't "apply" be used with "as.factor" on a data.frame ?

2010-03-07 Thread hadley wickham
The basic reason because apply works with matrices - it first turns the input into a matrix, processes each column and then returns a matrix. See colwise in the plyr package for a function that works column wise on a data frame, returning a data frame. Hadley On Sun, Mar 7, 2010 at 11:07 AM, Tal

Re: [R] questions about "Cusum"

2010-03-07 Thread Liviu Andronic
Hello On 3/7/10, sdzhangping wrote: > package. Can you give me some materials about Cusum test? An example is more > appreciated. > There seem to be several packages dealing with 'cusum'. Try this: library(sos) findFn('cusum') Also, perform a search on Rseek. Regards Liviu ___

[R] lme for repeated measures, one within, one between factor

2010-03-07 Thread Kay Cichini
hello list, the topic is covered extensively but from none of the postings i could conclude the correct statement for my design: a 2-level within and a 2-level between subjects factor, both fixed, subjects as random factor. i want to test wheter there is a within effect and if it is different fo

Re: [R] Why can't "apply" be used with "as.factor" on a data.frame ?

2010-03-07 Thread Tal Galili
Thanks for the explanation (and the function) Hadley. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (Eng

Re: [R] how to make this sequence: 1,2,3,4,5,4,3,2,1

2010-03-07 Thread Jim Lemon
On 03/06/2010 09:35 AM, j verzani wrote: ... Sorry about that one. On the errata page I have: page 16, exercise 1.12 #5 This one is most easily done using c() and the sequence operator :. (Please ignore request to use just seq and rep.) And all over the world, perhaps even on other planets

Re: [R] questions about "Cusum"

2010-03-07 Thread Achim Zeileis
On Sun, 7 Mar 2010, sdzhangping wrote: Dear friends: I have just read an article entitled " Monitoring of nosocomial invasive aspergillosis and early evidence of an outbreak using cumulative sum tests (CUSUM)", which is published in "Clinical Microbiology and Infection". We have great need t

[R] category k-means package?

2010-03-07 Thread James Salsman
What happened to the category k-means package for performing k-means clustering on categorical variables? I expected it to become more prominent after the Netflix Challenge recommendation engine contest concluded, but instead it seems to have dropped from view. Where was it and where is it now, a

Re: [R] category k-means package?

2010-03-07 Thread James Salsman
Nevermind, I found it: http://cran.at.r-project.org/web/packages/knncat/index.html On Sat, Mar 6, 2010 at 10:43 PM, James Salsman wrote: > What happened to the category k-means package for performing k-means > clustering on categorical variables?  I expected it to become more > prominent after th

Re: [R] how to make this sequence: 1,2,3,4,5,4,3,2,1

2010-03-07 Thread Gabor Grothendieck
On Sun, Mar 7, 2010 at 4:28 AM, Jim Lemon wrote: > On 03/06/2010 09:35 AM, j verzani wrote: >> >> ... >> Sorry about that one. On the errata page I have: >> >> page 16, exercise 1.12 #5 >>     This one is most easily done using c() and the sequence operator :. >> (Please >> ignore request to use j

Re: [R] variable substitution in for loops

2010-03-07 Thread kulwinder banipal
In absence of workable code, I assume you are trying to find the mean of column by referring to its name (which is read from another file). try...v<-mean(Dataset[, paste(varlist[i])]) Kulwinder > From: dwinsem...@comcast.net > To: jw...@klaru-baycrest.on.ca > Date: Wed, 24 Feb 2010 20:56:26 -0

Re: [R] Is it possible to recursively update a function?

2010-03-07 Thread cgw
Well, it takes a bit of hacking with concatenation functions followed by get, eval, and parse, but I've written functions/scripts which build functions like the f1,f2,... below out of various strings. Heck, I even (don't ask :-) ) wrote a tool to invert an array along a specified dimension.

Re: [R] SVGAnnotation in Windows

2010-03-07 Thread Yihui Xie
SVGAnnotation works fine for me under Windows. I guess Cleber was using R < 2.10. Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA 2010/3/6 Uwe Ligges : > > > On 06.03.2010 18:35, Cleber Borges w

[R] barplot with factors problem

2010-03-07 Thread casperyc
http://www.harding.edu/fmccown/R/#autosdatafile http://www.harding.edu/fmccown/R/#autosdatafile I am tring to get a barchat by factors, following the example in that link above. === x=c(145,40,40,120,180, 140,155,90,160,95, 195,150,205,110,160, 45

Re: [R] Interpretation of 'swtich'

2010-03-07 Thread Uwe Ligges
On 06.03.2010 21:49, rkevinbur...@charter.net wrote: In browsing the source I see the following construct: res<- switch(type, working = , response = r, deviance = , pearson = if (is.null(object$weights)) r else r * sqrt(object$weights), partial = r) I under

Re: [R] barplot with factors problem

2010-03-07 Thread Uwe Ligges
On 07.03.2010 17:42, casperyc wrote: http://www.harding.edu/fmccown/R/#autosdatafile http://www.harding.edu/fmccown/R/#autosdatafile I am tring to get a barchat by factors, following the example in that link above. === x=c(145,40,40,120,180, 140,155,90,160,95,

Re: [R] memory error in for loop

2010-03-07 Thread Uwe Ligges
Probably a bug in the RdbiPgSQL package you are using. Please ciontact its maintainer and send a reproducible example. Best, Uwe Ligges On 06.03.2010 04:08, Peter wrote: hi, I have been attempting to run this script and am getting some strange results. The script connects to a database and r

Re: [R] xyplot: strip size

2010-03-07 Thread Peter Ehlers
On 2010-03-07 3:12, Hadassa Brunschwig wrote: Hi, I was wondering if there is a way to control the strip size in xyplot for example using the strip.default function. Or do I need to redraw the strips by myself? I would like to make the strip slimmer and I have reduced the font size using cex. H

Re: [R] memory error in for loop

2010-03-07 Thread Gabor Grothendieck
Try the RpgSQL package and see if you get the same problem. On Fri, Mar 5, 2010 at 10:08 PM, Peter wrote: > hi, > > I have been attempting to run this script and am getting some strange > results. The script connects to a database and retrieves a series of tables, > using sequential sql statement

[R] mlogit

2010-03-07 Thread cmc
I am trying to follow this example for multinomial logistic regression http://www.ats.ucla.edu/stat/r/dae/mlogit.htm However, I cannot get it to work properly. This is the output I get, and I get an error when I try to use the mlogit function. Any ideas as to why this happens? > mydata <- r

[R] timestamp shifted by hour(s) while mering zoo objects

2010-03-07 Thread Keith
Dear R-users, I have two regular hourly time series data which were recorded in time zone GMT+1, and now I would like to merge them together for further analyses. Here I used zoo and merge.zoo for my purposes and everything worked fine except the timestamp shifted 2 hours after merging which

Re: [R] mlogit

2010-03-07 Thread David Winsemius
On Mar 7, 2010, at 12:06 PM, cmc wrote: I am trying to follow this example for multinomial logistic regression http://www.ats.ucla.edu/stat/r/dae/mlogit.htm However, I cannot get it to work properly. This is the output I get, and I get an error when I try to use the mlogit function. Any

Re: [R] timestamp shifted by hour(s) while mering zoo objects

2010-03-07 Thread Gabor Grothendieck
Without reproducible code (that means we can copy your code from your post, paste it into our session and see the same problem that you see) there is not much that can be said that addresses your specific situation but in terms of general advice: - the inappropriate use of time zones is a frequent

Re: [R] barplot with factors problem

2010-03-07 Thread casperyc
http://n4.nabble.com/file/n1583733/100307070476876317b486a941.jpg I want to get a histogram by factors. Thanks. -- View this message in context: http://n4.nabble.com/barplot-with-factors-problem-tp1583671p1583733.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
On 2010-03-07 10:30, David Winsemius wrote: On Mar 7, 2010, at 12:06 PM, cmc wrote: I am trying to follow this example for multinomial logistic regression http://www.ats.ucla.edu/stat/r/dae/mlogit.htm However, I cannot get it to work properly. This is the output I get, and I get an error

[R] vectorizing ANOVA over a vectorized linear model

2010-03-07 Thread Mark Kimpel
Is it possible to vectorize anova over the output of a vectorized lm? I have a gene expression matrix with each row being a gene and columns for samples. There are several factors with interactions. I can get p values by looping over the matrix with lm and anova, but I would like to make this as c

Re: [R] mlogit

2010-03-07 Thread cmc
I have tried doing it whithout attaching the mydata file, and i still get the same output. When i create mldata using mlogit.data i do not generate the chid and alt columns, is this where the problem is, if so how do i fix this problem. Cheers for any help -- View this message in context: http:

Re: [R] mlogit

2010-03-07 Thread David Winsemius
Looks like a problem that the maintainer should be copied with: > maintainer("mlogit") [1] "Yves Croissant " Not sure why it should affect your systems and not mine, but here is my sessionInfo() if it helps: > sessionInfo() R version 2.10.1 RC (2009-12-09 r50695) x86_64-apple-darwin9.8.0 lo

Re: [R] Error in inherits(x, "data.frame") : subscript out of bounds

2010-03-07 Thread Uwe Ligges
On 05.03.2010 15:24, kloyt...@mappi.helsinki.fi wrote: Hi, I have a list p with different size dataframes and length of over 8000. I'm trying to calculate correlations between the rows of dataframes of this list and columns of another dataset (type data.frame also) so that first column is corre

[R] Is there an equivalence of lm's “anova ” for an rpart object ?

2010-03-07 Thread Tal Galili
Simple example: # Classification Tree with rpart library(rpart) # grow tree fit <- rpart(Kyphosis ~ Age + Number + Start, method="class", data=kyphosis) Now I would like to know how can I measure the "importance" of each of my three explanatory variables (Age, Number, Start) in the model

Re: [R] vectorizing ANOVA over a vectorized linear model

2010-03-07 Thread Dieter Menne
Mark Kimpel wrote: > > Is it possible to vectorize anova over the output of a vectorized lm? > library(nlme) fm1 <- lmList(distance ~ age | Subject, Orthodont) lapply(fm1,anova) Dieter -- View this message in context: http://n4.nabble.com/vectorizing-ANOVA-over-a-vectorized-linear-model

Re: [R] transposing data

2010-03-07 Thread Frank Tamborello
Ah, this clarifies what the reshape documentation referred to as the "timevar" argument. I'd gone wrong because I'd been confusing reshape's functionality with that of SPSS's cassestovars command, which is where I'm coming from. Your recommendation seems to lead to exactly that I was lookin

Re: [R] vectorizing ANOVA over a vectorized linear model

2010-03-07 Thread hadley wickham
Hi Mark, If efficiency is a concern you might want to read "Computing Thousands of Test Statistics Simultaneously in R" by Holger Schwender and Tina Müller, http://stat-computing.org/newsletter/issues/scgn-18-1.pdf. If you just want to do it, see the examples in http://had.co.nz/plyr/plyr-intro-0

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
David, Here's my sessionInfo: > sessionInfo() R version 2.11.0 Under development (unstable) (2010-03-02 r51195) i386-pc-mingw32 locale: [1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 [3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C [5] LC_TIME=English_Canada.1252 attached bas

[R] Some hints for the R beginner

2010-03-07 Thread Patrick Burns
There is now a document called "Some hints for the R beginner" whose purpose is to get people up and running with R as quickly as possible. Direct access to it is: http://www.burns-stat.com/pages/Tutor/hints_R_begin.html JRR Tolkien wrote a story (sans hobbits) called 'Leaf by Niggle' that has a

Re: [R] scientific (statistical) foundation for Y-RANDOMIZATION in regression analysis

2010-03-07 Thread Max Kuhn
It worth adding that, for evaluating the quality of a model, randomization is fairly useless. Basically, as long as your model is slightly better than noise, it can show a significant difference from the average randomized model. In the qsar studies that we do, the samples sizes can be in the hund

[R] data.frame question

2010-03-07 Thread joseph
hello can you show me how to create a data.frame from two factors x and y. column 1 should be equal to x and column 2 is 1 if it is common to y and 0 if it is not. x=factor(c("A","B","C","D","E","F","G")) y=factor(c("B","C","G")) the output should look like this: A0 B1 C1 D0 E

Re: [R] data.frame question

2010-03-07 Thread baptiste auguie
Hi, try this, data.frame(x,as.numeric(x %in% y)) HTH, baptiste On 7 March 2010 21:06, joseph wrote: > hello > > can you show me how to create a data.frame from two factors x and y. column 1 > should be equal to x and column 2 is 1 if it is common to y and 0 if it is > not. > > x=factor(c("A

Re: [R] data.frame question

2010-03-07 Thread Stephan Kolassa
Hi, data.frame(x=x,y=as.numeric(x%in%y)) HTH, Stephan joseph schrieb: hello can you show me how to create a data.frame from two factors x and y. column 1 should be equal to x and column 2 is 1 if it is common to y and 0 if it is not. x=factor(c("A","B","C","D","E","F","G")) y=factor(c("B",

Re: [R] timestamp shifted by hour(s) while mering zoo objects

2010-03-07 Thread CHI-YU
Thanks Gabor, You're right. The problem comes from the environment variable TZ. I just tried the Sys.getenv("TZ") and it's nothing there. After I have set the environment variable TZ as the same as the data, let's say Sys.setenv(TZ="GMT+1"), the problem is gone. In order to complete the prob

Re: [R] Why can't "apply" be used with "as.factor" on a data.frame ?

2010-03-07 Thread Don MacQueen
And just a small followup. To find out what class each column is, you wanted lapply(a,class) $x1 [1] "numeric" $x2 [1] "factor" $x3 [1] "factor" With regard to your solution, and why it works, it is my understanding that data frames are in some sense actually lists, each column correspond

Re: [R] timestamp shifted by hour(s) while mering zoo objects

2010-03-07 Thread Gabor Grothendieck
On my Vista system I get an error message saying that there is no such timezone as GMT+1. You may be better off not using time zones and just adjusting the times yourself. You could just use chron and avoid the entire time zone problem in the first place. In the first of the two approaches below

Re: [R] timestamp shifted by hour(s) while mering zoo objects

2010-03-07 Thread Keith
Thanks Gabor, Just one comment on the error you received on the Vista machine. I also noticed this problem on Windows as well, and found there is no specification of "GMT+1" on Windows XP. The closest setting for "GMT+1" on windows is "Africa/Lagos", however there is no this problem on *unix

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
On 2010-03-07 10:41, cmc wrote: I have tried doing it whithout attaching the mydata file, and i still get the same output. When i create mldata using mlogit.data i do not generate the chid and alt columns, is this where the problem is, if so how do i fix this problem. I've suggested not nami

Re: [R] Why can't "apply" be used with "as.factor" on a data.frame ?

2010-03-07 Thread David Winsemius
On Mar 7, 2010, at 3:20 PM, Don MacQueen wrote: And just a small followup. To find out what class each column is, you wanted lapply(a,class) $x1 [1] "numeric" $x2 [1] "factor" $x3 [1] "factor" With regard to your solution, and why it works, it is my understanding that data frames are

Re: [R] Interpretation of 'swtich'

2010-03-07 Thread rkevinburton
Thatnk you. The documentation indicates as you indicated that if there is not an exact match then the next element is chosen. But it does not indicate the case that contains an exact match but there is not value to be returned (=, case). From what you indicate this is treated as if it was not a

[R] aggregate for zoo or its?

2010-03-07 Thread Erin Hodgess
Dear R People: The aggregate function works very well on regular time series. Is there a version for zoo or its that would take daily data and convert it to monthly, please? Thanks in advance, Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences

Re: [R] aggregate for zoo or its?

2010-03-07 Thread Gabor Grothendieck
See ?aggregate.zoo, e.g. library(zoo) z <- zoo(1:1000, as.Date("2000-01-01") + 0:999) aggregate(z, as.yearmon, mean) or replace mean with whatever summarization you want. On Sun, Mar 7, 2010 at 5:29 PM, Erin Hodgess wrote: > Dear R People: > > The aggregate function works very well on regular t

Re: [R] How to create a line and bar panel chart with two different axes?

2010-03-07 Thread DougNiu
Deepayan: Thank you so much for your time and hints on my question. The examples do help me move further. I will let you know once I solve the whole question. Have a good day! Doug On Mar 6 2010, Deepayan Sarkar [via R] wrote: > > > >On Wed, Mar 3, 2010 at 12:35 PM, DougNiu wrote: >> >> I

Re: [R] r code to generate interaction columns

2010-03-07 Thread kMan
Dear Dhruv, You could create interaction variables manually (assuming A is your dependent variable). Just multiply the variables together. cd.int<-C*D ce.int<-C*E cde.int<-C*D*E # what about D*E, or interactions with B? Include those in your model, such as A~B+C+D+E+cd.int+cd.int+ce.int+cde.int.

Re: [R] Interpretation of 'swtich'

2010-03-07 Thread Duncan Murdoch
On 07/03/2010 5:26 PM, rkevinbur...@charter.net wrote: Thatnk you. The documentation indicates as you indicated that if there is not an exact match then the next element is chosen. But it does not indicate the case that contains an exact match but there is not value to be returned (=, case). F

Re: [R] vectorizing ANOVA over a vectorized linear model

2010-03-07 Thread Mark Kimpel
Hadley, Thanks for pointing me to some good articles. Unfortunately, I have already read Holger's and my main concern is computational efficiency. The buzzword on this list regarding efficient code is "vectorization". I am, frankly, surprised that there is a way to vectorize analysis of complex mo

[R] Average regions of non-zeros

2010-03-07 Thread Daren Tan
x <- c(0,0,1,2,3,0,0,4,5,6) How to identify the regions of non-zeros and average c(1,2,3) and c(4,5,6) to get 2 and 5. Thanks _ Hotmail: Trusted email with Microsoft¡¯s powerful

[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Dgnn
I have split my original dataframe to generate a list of dataframes each of which has 3 columns of factors and a 4th column of numeric data. I would like to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am

[R] lapply and list indexing basics

2010-03-07 Thread Dgnn
I have split my original dataframe to generate a list of dataframes each of which has 3 columns of factors and a 4th column of numeric data. I would like to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am I

[R] How can I understand this sentence,and express it by means of Mathematical approach?

2010-03-07 Thread bbslover
This topic refer to independent variables reduction, as we know ,a lot of method can do with it,however, for pre-processing independent varibles, a method like the sentence below can reduce many variable, How can I understand it? what is significant correlation at 5% level, what is the criterion

Re: [R] Average regions of non-zeros

2010-03-07 Thread jim holtman
Try this: > x <- c(0,0,1,2,3,0,0,4,5,6) > # partition the data > x.p <- split(x, cumsum(x == 0)) > # now only process groups > 1 > x.mean <- lapply(x.p, function(a){ + if (length(a) == 1) return(NULL) + return(list(grp=tail(a, -1), mean=mean(tail(a, -1 + }) > # now only return the real

Re: [R] lapply and list indexing basics

2010-03-07 Thread jim holtman
It would have been nice if you had at least posted what the structure of myList is. Assuming that this is the list of your data frames, then the following might work: lapply(myList, function(x) fitdistr(x$isi, densfun='gamma',start=list(scale=1, shape=2))) On Sun, Mar 7, 2010 at 7:30 PM, Dgnn

Re: [R] mlogit

2010-03-07 Thread yves croissant
In the code of the mlogit function, the call is saved under the name 'mldata' that you use to store the result of the mlogit.data function. When calling mlogit with 'mldata' as the data argument, there is a conflict between these two objects with the same name, one of class 'call' and one of class

Re: [R] xyplot: strip size

2010-03-07 Thread Hadassa Brunschwig
Thanks that solved my problem. Hadassa On Sun, Mar 7, 2010 at 7:04 PM, Peter Ehlers wrote: > On 2010-03-07 3:12, Hadassa Brunschwig wrote: > >> Hi, >> >> I was wondering if there is a way to control >> the strip size in xyplot for example using the >> strip.default function. Or do I need to redr

Re: [R] vectorizing ANOVA over a vectorized linear model

2010-03-07 Thread hadley wickham
Hi Mark, Unless you are fitting millions of very very very simple models, I doubt that extracting p-values is going to be a limiting factor in the speed of your analysis. Hadley On Mon, Mar 8, 2010 at 3:47 AM, Mark Kimpel wrote: > Hadley, > > Thanks for pointing me to some good articles. Unfort

Re: [R] Average regions of non-zeros

2010-03-07 Thread Dimitris Rizopoulos
try this: x <- c(0,0,1,2,3,0,0,4,5,6) rl <- rle(x == 0) grp <- rep(seq_along(rl$lengths), rl$lengths) res <- tapply(x, grp, mean) res[res > 0] I hope it helps. Best, Dimitris On 3/8/2010 3:48 AM, Daren Tan wrote: x<- c(0,0,1,2,3,0,0,4,5,6) How to identify the regions of non-zeros and a

[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Simon Knapp
library(MASS) dat <- data.frame( col1=as.factor(sample(1:4, 100, T)), col2=as.factor(sample(1:4, 100, T)), col3=as.factor(sample(1:4, 100, T)), isi=rnorm(100) ) dat <- split(dat, as.factor(sample(1:3, 100, T))) lapply(dat, function(x, densfun) fitdistr(x$isi, densfun), 'normal')

Re: [R] mlogit

2010-03-07 Thread Achim Zeileis
On Mon, 8 Mar 2010, yves croissant wrote: In the code of the mlogit function, the call is saved under the name 'mldata' that you use to store the result of the mlogit.data function. When calling mlogit with 'mldata' as the data argument, there is a conflict between these two objects with the sam

[R] Odp: Data frame query

2010-03-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.03.2010 13:40:54: > > I have created a large dataframe (d) by getting data from file using > read.table > > I now have 79 columns and 3 million rows. How can I plot the 6th column? I > tried plot(d[,6]) but it doesn't look right. When I try to do j