Re: [R] A question about R environment

2007-01-09 Thread Tong Wang
Francois (sorry can't type the right letter) , thanks a million for the detailed response, you have really cool functions there ! Philippe : I will definitely follow your advice later, but I got some time pressure from the current project, so have to go with the easy sol. now , thanks a

Re: [R] A question about R environment

2007-01-09 Thread Tong Wang
Hi, Thanks a lot for your response, but it is strange that when I do attach() , I got the follow error: Error in attach(e) : attach only works for lists and data frames Any suggestions on this? tong - Original Message - From: Henrik Bengtsson [EMAIL PROTECTED] Date: Monday,

[R] Multivariate OLS

2007-01-09 Thread r400 r400
Dear all R users, Suppose I have a VECTOR of time series y[t] consists of 2000 data point. For example suppose I have data frame which has two columns. First column represents a time series of exchange rate for 2000 days. And the second column represents the price of a commodity for the same

Re: [R] Cross-compilation of R and ld bug ?

2007-01-09 Thread Stéphane Dray
Not sure to really understand 1) . The makefile (available at http://cran.r-project.org/doc/contrib/Makefile-rcb) use wget --passive-ftp http://www.stats.ox.ac.uk/pub/Rtools/mingw-cross5.tar.bz2; This version seems to be the current, I am correct ? Note that : [EMAIL

Re: [R] Cross-compilation of R and ld bug ?

2007-01-09 Thread Prof Brian Ripley
On Tue, 9 Jan 2007, Stéphane Dray wrote: Not sure to really understand 1) . The makefile (available at http://cran.r-project.org/doc/contrib/Makefile-rcb) use wget --passive-ftp http://www.stats.ox.ac.uk/pub/Rtools/mingw-cross5.tar.bz2; This version seems to be the current, I am correct ?

Re: [R] A question about R environment

2007-01-09 Thread Prof Brian Ripley
On Tue, 9 Jan 2007, Tong Wang wrote: Hi, Thanks a lot for your response, but it is strange that when I do attach() , I got the follow error: Error in attach(e) : attach only works for lists and data frames Any suggestions on this? Update your R, as the posting guide asked you to in

Re: [R] R scripts to plot Taylor Diagram

2007-01-09 Thread Olivier ETERRADOSSI
Happy New Year, dear useRs...and Linda. I have a small toy-script that plots Taylor Diagrams for vectors, it is not wonderful but may help... perhaps you can change some details for your own needs. It is far from optimization,... perhaps someone can do this and put it into a package ? Hope this

[R] Random effects and level 1 censoring

2007-01-09 Thread John Logsdon
I have a question about constructing the likelihood function where there is censoring at level 1 in a two-level random effects sum. In a conventional solution, the likelihood function is constructed using the density for failures and the survivor function for (in this case, right) censored

Re: [R] contingency table analysis; generalized linear model

2007-01-09 Thread Mark Difford
Dear List, I would appreciate help on the following matter: I am aware that higher dimensional contingency tables can be analysed using either log-linear models or as a poisson regression using a generalized linear model: log-linear: loglm(~Age+Site, data=xtabs(~Age+Site, data=SSites.Rev,

Re: [R] Multivariate OLS

2007-01-09 Thread r400 r400
Dear David, Thank you very much for this reply. But unfortunately it is not that I want. In my equation 'a' is a vector with length 2, 'b' and 'c' are matrix with row and columns 2. It is like Vector Autoregressive model, but there is some difference between that model and my model. Is there

[R] logistic regression in R - changing defaults

2007-01-09 Thread Bob Green
Hello, I was hoping for some advice in changing 2 defaults in a logistic regression. 1. It looks like the first category is the reference category? In the following syntax 'where' has 4 levels, how can I make the reference category the third category? model- glm(cbind(sucesses, failures) ~

Re: [R] logistic regression in R - changing defaults

2007-01-09 Thread Dimitris Rizopoulos
an option is to use ?relevel(), e.g., life.use$where. - relevel(life.use$where, 3) model- glm(cbind(sucesses, failures) ~ where. + who + firstep + dxnarrow + age + sex + medyear, family = binomial, data = life.use) print(model, digits = 1) print(model, digits = 2) print(model, digits

[R] a question of substitute

2007-01-09 Thread Adrian Dusa
Hi all, I want to write a wrapper for an analysis of variance and I face a curious problem. Here are two different wrappers: fun.1 - function(formula) { summary(aov(formula)) } fun.2 - function(formula) { oneway.test(formula) } values - c(15, 8, 17, 7, 26, 12, 8, 11, 16, 9, 16,

Re: [R] a question of substitute

2007-01-09 Thread Gabor Grothendieck
oneway.test is using substitute on its arguments so its literally getting formula rather than the value of formula. Try these: fun.3 - function(formula) { mc - match.call() mc[[1]] - as.name(oneway.test) eval.parent(mc) } fun.3(values ~ group) fun.4 - function(formula) {

Re: [R] memory problem --- use sparse matrices

2007-01-09 Thread Zoltan Kmetty
Unfortunatelly, i have to fill all the cells, with numbers..., so I need a better machine, or i have to split the data for smaller parts, but that way is much slower, but i see i dont have other alternative way. But thanx for your help, because i work with big networks too (1 vertex), and

Re: [R] a question of substitute

2007-01-09 Thread Adrian Dusa
On Tuesday 09 January 2007 15:14, Gabor Grothendieck wrote: oneway.test is using substitute on its arguments so its literally getting formula rather than the value of formula. Ah-haa... I understand now. Thanks for the tips, they both work as expected. Best, Adrian Try these: fun.3 -

Re: [R] a question of substitute

2007-01-09 Thread Prof Brian Ripley
oneway.test expects a literal formula, not a variable containing a formula. The help page says formula: a formula of the form 'lhs ~ rhs' where 'lhs' gives the sample values and 'rhs' the corresponding groups. Furthermore, if you had foo.2 - function() oneway.test(value ~ group)

Re: [R] Access, Process and Read Information from Web Sites

2007-01-09 Thread bogdan romocea
Not sure about R, but for a Perl example check http://yosucker.sourceforge.net/ . -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tudor Bodea Sent: Monday, January 08, 2007 11:53 AM To: r-help@stat.math.ethz.ch Cc: Tudor Bodea Subject: [R] Access,

Re: [R] a question of substitute

2007-01-09 Thread Adrian Dusa
On Tuesday 09 January 2007 15:41, Prof Brian Ripley wrote: oneway.test expects a literal formula, not a variable containing a formula. The help page says formula: a formula of the form 'lhs ~ rhs' where 'lhs' gives the sample values and 'rhs' the corresponding groups.

[R] min() return factor class values

2007-01-09 Thread Milton Cezar Ribeiro
Hi R-friends I don´t know why the min() function below return the min value as factor. When i force the aicc.min using a as.numeric() function, it return a factor index (1,2,..) and not min value as I want. By the way, I included a sessionInfo() at the end of this e-mail. In fact I

Re: [R] limitation in the number of covariates in nlme

2007-01-09 Thread mohammad frarouei
Thanks Brian The new version fixed the problem. Prof Brian Ripley [EMAIL PROTECTED] wrote: Please check you have the latest version of nlme (3.1-79), as some restrictions of this sort were lifted a few weeks ago. If you have, please note the advice about a minimal reproducible example in

[R] dimensions of a all objects

2007-01-09 Thread Farrel Buchinsky
Why will the following command not work sapply(objects(),dim) What does it say about the objects list? What does it say about the dim command? Likewise, the following also does not work all-ls() for (f in all) print(dim(f)) -- Farrel Buchinsky [[alternative HTML version deleted]]

[R] RSQLite NA on input

2007-01-09 Thread R Gott
Hello I haev some .csv data files with missing values - eg below 1,'F','C04','X100',20.93,'C','B',7,8,7.5,2421,2230,2230,2,1,85,43,85,46,48,60 If I have a missing value - so file looks like ,85,46,,48, etc then RSQLite reads it as zero. ,85,46,0,48, etc I need it read it as NA. Tried various

Re: [R] dimensions of a all objects

2007-01-09 Thread ONKELINX, Thierry
You need something like this: sapply(objects() , function(x)(dim(eval(parse(text = x) a - rnorm(1) b - matrix(rnorm(4), ncol = 2, nrow = 2) sapply(objects() , function(x)(dim(eval(parse(text = x) $a NULL $b [1] 2 2 Cheers, Thierry

Re: [R] min() return factor class values

2007-01-09 Thread Peter Dalgaard
Milton Cezar Ribeiro wrote: Hi R-friends I don´t know why the min() function below return the min value as factor. When i force the aicc.min using a as.numeric() function, it return a factor index (1,2,..) and not min value as I want. By the way, I included a sessionInfo() at the

Re: [R] dimensions of a all objects

2007-01-09 Thread Barry Rowlingson
Farrel Buchinsky wrote: Why will the following command not work sapply(objects(),dim) What does it say about the objects list? What does it say about the dim command? Likewise, the following also does not work all-ls() for (f in all) print(dim(f)) 'objects()' returns character strings

Re: [R] min() return factor class values

2007-01-09 Thread Zoltan Kmetty
Hi Milton! I don't know why, but this thing happend with me too, quite a lot times. It's a useful way that convert the value type like that: *as.numeric(as.character(min(...)))* Zoltan 2007/1/9, Milton Cezar Ribeiro [EMAIL PROTECTED]: Hi R-friends I don´t know why the min() function below

Re: [R] dimensions of a all objects

2007-01-09 Thread Martin Maechler
BaRow == Barry Rowlingson [EMAIL PROTECTED] on Tue, 09 Jan 2007 14:53:05 + writes: BaRow Farrel Buchinsky wrote: Why will the following command not work sapply(objects(),dim) What does it say about the objects list? What does it say about the dim command?

[R] posthoc tests with ANCOVA

2007-01-09 Thread Walter Durka
dear all, I want to perform a posthoc test for my ANCOVA: a1-aov(seeds~treatment*length) With summary(glht(a1, linfct = mcp(treatment = Tukey))) R tells me: covariate interactions found -- please choose appropriate contrast How do I build these contrasts? Ideally, I would like to have the

Re: [R] dimensions of a all objects

2007-01-09 Thread Farrel Buchinsky
You have assumed everything as I meant it. I understand what is happening now. ls() simply creates a vector with character elements and dim() sees each element as not having dimensions. The critical part of what you have shown is the get(command) that turns what is just a string into the dataframe

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
Guys, thanks very much for your help. Rscript looks great and I'll look forward to it. The /usr/bin/env thing seems to be a general difficulty with the mechanism. One's first thought has to be to modify env to parse and then pass the arguments in the expected way (maybe #!/usr/bin/env2?), and of

[R] manipulating elements of lists

2007-01-09 Thread Christoph Heibl
I want to manipulate lists as described below: Imagine these two lists: list1 $WR7 [1] 1 2 3 4 $YH5YH6 [1] 3 4 5 6 7 $YH4 [1] 4 5 $UC4UC8 [1] 4 5 6 7 8 9 list2 V1V2 1WR7Averrhoa 2 ? Sarcotheca 3 YH5YH6

Re: [R] RSQLite NA on input

2007-01-09 Thread Seth Falcon
Hi Richard, It would help if you provided a bit more on how you are going about the import (along with your version of R and RSQLite). R Gott [EMAIL PROTECTED] writes: I haev some .csv data files with missing values - eg below

Re: [R] listing all functions in R

2007-01-09 Thread Seth Falcon
Earl F. Glynn [EMAIL PROTECTED] writes: Prof Brian Ripley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here is a reasonable shot: findfuns - function(x) { if(require(x, character.only=TRUE)) { env - paste(package, x, sep=:) nm - ls(env, all=TRUE)

Re: [R] dimensions of a all objects

2007-01-09 Thread Gabor Grothendieck
See below. On 1/9/07, Farrel Buchinsky [EMAIL PROTECTED] wrote: You have assumed everything as I meant it. I understand what is happening now. ls() simply creates a vector with character elements and dim() sees each element as not having dimensions. The critical part of what you have shown is

Re: [R] odfWeave and figures in MS Word Format

2007-01-09 Thread Kuhn, Max
Laurent, Since you question was not about odfWeave (despite the message title), it would have been better to send this question to an OpenOffice mailing list. That said, I think that the issues was your workflow (odt - html - doc). HTML is plain text, so when you saved the file in that format

Re: [R] min() return factor class values

2007-01-09 Thread Milton Cezar Ribeiro
Dear Peter, I tryed something like head(especies.aicc) especie aicc 1 Attila.rufus 17.15934 2 Attila.rufus 11.41371 3 Attila.rufus 11.41371 4 Attila.rufus 19.55998 5 Attila.rufus 17.23780 6 Attila.rufus 19.22545 especies.min-aggregate.data.frame(especies.aicc,list

Re: [R] min() return factor class values

2007-01-09 Thread Peter Dalgaard
Milton Cezar Ribeiro wrote: Dear Peter, I tryed something like head(especies.aicc) especie aicc 1 Attila.rufus 17.15934 2 Attila.rufus 11.41371 3 Attila.rufus 11.41371 4 Attila.rufus 19.55998 5 Attila.rufus 17.23780 6 Attila.rufus 19.22545

[R] Logical operations or selecting data from data.frames

2007-01-09 Thread Benjamin Dickgiesser
Hi all, why doesn't something like this does not work? speedy - (sdata$VaR sdata$DdtdAbs) sdata$DdtdDuration = qpois(pct,lambda) sdata$Ddtd MinDD or sdata$Ddtd[sdata$Ddtd 0 sdata$VaR sdata$DdtdAbs] sdata looks like this: dataId date value Ddtd VaR

Re: [R] Logical operations or selecting data from data.frames

2007-01-09 Thread Benjamin Dickgiesser
I suppose this doesn't work for the same reason as sdata$VaR sdata$DdtdAbs sdata$DdtdDuration = 1 does only return FALSE and not a vector of TRUE and FALSE as sdata$VaR sdata$DdtdAbs would return. Is there a ways around this? Benjamin On 1/9/07, Benjamin Dickgiesser [EMAIL PROTECTED]

Re: [R] min() return factor class values

2007-01-09 Thread Benilton Carvalho
Milton, have you looked at the structure of your data.frame? str(especies.aicc) Are you sure especies.aicc is defined as numeric? b On Jan 9, 2007, at 10:51 AM, Milton Cezar Ribeiro wrote: Dear Peter, I tryed something like head(especies.aicc) especie aicc 1

Re: [R] Simple spectral analysis

2007-01-09 Thread Earl F. Glynn
Georg Hoermann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Peter Dalgaard wrote: Earl F. Glynn wrote: Thanks a lot for the help. I will post the script when its ready (an introduction for our biology students to time series, just 8 hours) I've been working with one of our labs

Re: [R] Logical operations or selecting data from data.frames

2007-01-09 Thread Johan Sandblom
Is the solution this simple? sdata$VaR sdata$DdtdAbs sdata$DdtdDuration = 1 Regards, Johan 2007/1/9, Benjamin Dickgiesser [EMAIL PROTECTED]: I suppose this doesn't work for the same reason as sdata$VaR sdata$DdtdAbs sdata$DdtdDuration = 1 does only return FALSE and not a vector of TRUE

Re: [R] Logical operations or selecting data from data.frames

2007-01-09 Thread Roger Bivand
On Tue, 9 Jan 2007, Benjamin Dickgiesser wrote: I suppose this doesn't work for the same reason as sdata$VaR sdata$DdtdAbs sdata$DdtdDuration = 1 does only return FALSE and not a vector of TRUE and FALSE as See ?: '' and '' indicate logical AND and '|' and '||' indicate

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
John Lawrence Aspden wrote: I'm actually tempted to use #!/usr/bin/env r rm(list=ls()) Ahem, it turns out to be better to use: #!/usr/bin/env r rm(list=ls()[ls()!=argv]) -- Contractor in Cambridge UK -- http://www.aspden.com __

Re: [R] Logical operations or selecting data from data.frames

2007-01-09 Thread Benjamin Dickgiesser
Thx for the help, sorry I am just used to use from php and simply assumed it would work identically. On 1/9/07, Patrick Burns [EMAIL PROTECTED] wrote: S Poetry (and other documentation) will tell you the difference between '' and ''. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696

Re: [R] odfWeave and figures in MS Word Format

2007-01-09 Thread Laurent Rhelp
Kuhn, Max a écrit : Laurent, Since you question was not about odfWeave (despite the message title), it would have been better to send this question to an OpenOffice mailing list. That said, I think that the issues was your workflow (odt - html - doc). HTML is plain text, so when you saved the

Re: [R] How to use Rattle for Data mining through R?

2007-01-09 Thread Graham Williams
Received Tue 09 Jan 2007 12:36pm +1100 from Bhanu Kalyan.K: Dear Mr. Bengtsson, Now i am able to work with R-Matlab interface comfortably. Thanks to you. Recently, I came to know that R can be used for data mining as well. I went through the following site for this :

Re: [R] scripts with littler

2007-01-09 Thread Jeffrey Horner
John Lawrence Aspden wrote: John Lawrence Aspden wrote: I'm actually tempted to use #!/usr/bin/env r rm(list=ls()) Ahem, it turns out to be better to use: #!/usr/bin/env r rm(list=ls()[ls()!=argv]) Eww!! I'm not sure you want to do that. I would recommend sticking with:

[R] differential item function for item response theory

2007-01-09 Thread SHEN,FENG
Hi my friends, I'm very new to R and need your help. I used R and ltm package for item response theory (IRT) modeling. I also need to compute differential item function (DIF) for IRT models. I searched the archive but basically found nothing. Could you help me find some sources about

[R] A vectorization question

2007-01-09 Thread Christos Hatzis
Hi, A function calculates the absolute difference between the two largest values of each row of a matrix, as shown in the following example code: cx - matrix(runif(15),5) cy - t( apply(cx, 1, order, decreasing=TRUE) ) cz - rep(0, nrow(cx)) for( i in 1:nrow(cx) ) cz[i] - abs(diff(cx[i,

Re: [R] differential item function for item response theory

2007-01-09 Thread Doran, Harold
I don't know of any functions specifically designed to handle DIF (e.g., mantel-hantzel). But, ltm does give you the point estimates and standard errors so you can do a t-test between the focal and reference groups. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: [R] randomForest and missing data

2007-01-09 Thread Bálint Czúcz
There is an improved version of the original random forest algorithm available in the party package (you can find some additional information on the details here: http://www.stat.uni-muenchen.de/sfb386/papers/dsp/paper490.pdf ). I do not know whether it yields a solution to your problem about

Re: [R] A vectorization question

2007-01-09 Thread Marc Schwartz
On Tue, 2007-01-09 at 16:10 -0500, Christos Hatzis wrote: Hi, A function calculates the absolute difference between the two largest values of each row of a matrix, as shown in the following example code: cx - matrix(runif(15),5) cy - t( apply(cx, 1, order, decreasing=TRUE) ) cz -

Re: [R] A vectorization question

2007-01-09 Thread Christos Hatzis
Thanks, Marc. This is what I was trying to do but could not get it to work. -Christos -Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 09, 2007 4:32 PM To: [EMAIL PROTECTED] Cc: 'R-help' Subject: Re: [R] A vectorization question On Tue,

Re: [R] scripts with littler

2007-01-09 Thread John Lawrence Aspden
Jeffrey Horner wrote: John Lawrence Aspden wrote: I'm actually tempted to use #!/usr/bin/env r rm(list=ls()[ls()!=argv]) Eww!! I'm not sure you want to do that. I would recommend sticking with: #!/usr/bin/r -v as that gives you a truer scripting environment. I understand that

Re: [R] A vectorization question

2007-01-09 Thread Marc Schwartz
Welcome Christos. Note that my first example can actually be simplified to: apply(mat, 1, function(x) -diff(sort(x, decreasing = TRUE)[1:2])) Since we really just need to negate the difference, rather than take the abs(). The advantage of this approach is that the two max values will always

Re: [R] A vectorization question

2007-01-09 Thread Christos Hatzis
That's true. Just need to negate the difference. Actually, straight diff can be used after reversing the vector: apply(mat, 1, function(x) diff(sort(x, decreasing = TRUE)[2:1])) I only have 3 columns in my matrix so sorting should not add much overhead, but I will time both versions. Thanks

Re: [R] listing all functions in R

2007-01-09 Thread Earl F. Glynn
Seth Falcon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Are you sure you need to? I just tried your code above with: pkgs - c(Biobase, GOstats, flrblr, bazbaz) And while I see warning messages about the flrblr and bazbaz packages, the function completed and I get the expected

Re: [R] manipulating elements of lists

2007-01-09 Thread talepanda
Maybe I misunderstand what you want to do, one solution is: l1 $a [1] 1 2 $b [1] 1 2 3 $c [1] 1 2 3 4 l2 V1 V2 1 d nd 2 c nc 3 b nb 4 a na names(l1)-sapply(names(l1),function(n)l2[l2$V1==n,2]) l1 $na [1] 1 2 $nb [1] 1 2 3 $nc [1] 1 2 3 4 On 1/10/07, Christoph Heibl [EMAIL

[R] roc and lattice

2007-01-09 Thread rhk
Hello, I am afraid I do not fully understand all intricacies of programming in lattice plots. In the code below I try to plot an ROC curve, following R-news 4(1). When I condition on the variable 'group' I get the error message below, when I plot the curve for all data (i.e., y ~ pred.prob), I