[R] Reshape (pivot) question

2007-02-20 Thread Lauri Nikkinen
Hi R-users, I have a data set like this (first ten rows): id patient_id date code class eala ID1564262 1562 6.4.2006 12:00 1 NA ID1564262 1562 6.4.2006 12:00 1 NA ID1564264 1365 14.2.2006 14:35 1 50 ID1564265 1342 7.4.2006 14:30 2 50 ID1564266 1648 7.4.200614:30 2 50

[R] interaction term and scatterplot3d

2007-02-20 Thread Patrick Giraudoux
Dear Listers, I would be interested in representing a trend surface including an interaction term z = f(x,y,x.y) - eg the type of chart obtained with persp() or wireframe(), then adding datapoints as a cloud, ideally with dots which are under the surface in a color, and those who are above in

Re: [R] Another subsetting enigma

2007-02-20 Thread Johannes Graumann
jim holtman wrote: matches - sapply(result, function(x){ +     .comma - strsplit(x, ',')[[1]]  # get the fields +     any(my.list %in% .comma) + }) Thanks for that! Joh __ R-help@stat.math.ethz.ch mailing list

[R] Difficulties with dataframe filter using elements from an array created using a for loop or seq()

2007-02-20 Thread Todd A. Johnson
Hi All- This seems like such a pathetic problem to be posting about, but I have no idea why this testcase does not work. I have tried this using R 2.4.1, 2.4.0, 2.3.0, and 2.0.0 on several different computers (Mac OS 10.4.8, Windows XP, Linux). Below the signature, you will find my test case R

Re: [R] bootstrapping Levene's test

2007-02-20 Thread Chuck Cleland
[EMAIL PROTECTED] wrote: Hello all, I am low down on the learning curve of R but so far I have had little trouble using most of the packages. However, recently I have run into a wall when it comes to bootstrapping a Levene's test (from the car package) and thought you might be able to

Re: [R] Difficulties with dataframe filter using elements from an array created using a for loop or seq()

2007-02-20 Thread Prof Brian Ripley
FAQ Q7.31 On Tue, 20 Feb 2007, Todd A. Johnson wrote: Hi All- This seems like such a pathetic problem to be posting about, but I have no idea why this testcase does not work. I have tried this using R 2.4.1, 2.4.0, 2.3.0, and 2.0.0 on several different computers (Mac OS 10.4.8, Windows

Re: [R] tree()

2007-02-20 Thread Prof Brian Ripley
This is a function of your data and the tuning parameters you chose to use. See ?tree.control. On Tue, 20 Feb 2007, stephenc wrote: Hi I am trying to use tree() to classify movements in a futures contract. My data is like this: diff dip dim adx

[R] Mahalanobis distance and probability of group membership using Hotelling's T2 distribution

2007-02-20 Thread Mike White
I want to calculate the probability that a group will include a particular point using the squared Mahalanobis distance to the centroid. I understand that the squared Mahalanobis distance is distributed as chi-squared but that for a small number of random samples from a multivariate normal

Re: [R] Lengend function and moving average plot

2007-02-20 Thread John Kane
--- amna khan [EMAIL PROTECTED] wrote: Sir I am very new user of R. I am not understanding the how to write the plot description in box outside the plot. Have a look at http://finzi.psych.upenn.edu/R/Rhelp02a/archive/68585.html You should read up on par ?par I hope this helps

[R] Problems with obtaining t-tests of regression coefficients applying consistent standard errors after run 2SLS estimation. Clearer !!!!!

2007-02-20 Thread Guillermo Julián San Martín
First I have to say I am sorry because I have not been so clear in my previous e-mails. I will try to explain clearer what it is my problem. I have the following model: lnP=Sc+Ag+Ag2+Var+R+D In this model the variable Sc is endogenous and the rest are all objective exogenous variables. I

Re: [R] Reshape (pivot) question

2007-02-20 Thread jim holtman
Haven't quite learned to 'cast' yet, but I have always used the 'apply' functions for this type of processing: x - id patient_id date code class eala + ID1564262 1562 6.4.200612:00 1 NA + ID1564262 1562 6.4.200612:00 1 NA + ID1564264 1365 14.2.200614:35 1 50 +

[R] Sample size

2007-02-20 Thread SAULEAU Erik-André
Dear R-list, I have to design the validation of a score (ordinal values between 0 and 6) reputed to separate 4 groups of patients with known frequencies in the population. I think the more accurate is to calculate sample size under median test. Is there a function for that in R (not in the pwr

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Liaw, Andy
I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles suggest: work with the transpose so that you are accessing elements in the

Re: [R] Reshape (pivot) question

2007-02-20 Thread hadley wickham
Haven't quite learned to 'cast' yet, but I have always used the 'apply' functions for this type of processing: x - id patient_id date code class eala + ID1564262 1562 6.4.200612:00 1 NA + ID1564262 1562 6.4.200612:00 1 NA + ID1564264 1365 14.2.200614:35 1 50 +

Re: [R] summary polr

2007-02-20 Thread Michael Dewey
At 15:21 19/02/2007, Paolo Accadia wrote: Hi all, I have a problem to estimate Std. Error and t-value by “polr” in library Mass. They result from the summary of a polr object. I can obtain them working in the R environment with the following statements: temp - polr(formula =

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Federico Calboli
Liaw, Andy wrote: I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles suggest: work with the transpose so that you are

Re: [R] Sample size

2007-02-20 Thread Frank E Harrell Jr
SAULEAU Erik-André wrote: Dear R-list, I have to design the validation of a score (ordinal values between 0 and 6) reputed to separate 4 groups of patients with known frequencies in the population. I think the more accurate is to calculate sample size under median test. Is there a

[R] Reading Post-Script files

2007-02-20 Thread Ralf Finne
Hi everybody! Is there any way to read a postscrit file into R? All the best to you Ralf Finne SYH University of Applied Sciences Vasa Finland __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Reshape (pivot) question

2007-02-20 Thread Lauri Nikkinen
Thanks guys! Jim got it right what I was looking for. I think that the reason why I don't get this right with cast-function is that I don't know how to write a proper stats-function. SQL is still much easier for me. Lauri 2007/2/20, hadley wickham [EMAIL PROTECTED]: Haven't quite learned to

[R] contextstack overflow

2007-02-20 Thread Steven Finch
Hello! I written several implementations in R of Rémy's algorithm for generating random ordered strictly binary trees on 2n+1 vertices. One implementation involves manufacturing character strings like: X - list(0,list(0,0)) for the case n=2. If I perform the following two steps: cmd - X -

[R] contingency table for several variables

2007-02-20 Thread David LEVY
DearList, I ‘m trying to draw ONE table that summarize SEVERAL categorical variables according to one classification variable, say “sex”. The result would look like several contingency tables appended one to the other. All the variables belong to a data frame. The summary.formula in Hmisc

Re: [R] Installing Package rgl - Compilation Fails

2007-02-20 Thread Rick Bilonick
On Mon, 2007-02-19 at 15:11 -0600, Ranjan Maitra wrote: The error is different now. It now cannot find Xext library. Do a yum search on this and install that. yum provides libXext which will give you the package Xext which needs to be installed. You may also need to install the

Re: [R] contingency table for several variables

2007-02-20 Thread Frank E Harrell Jr
David LEVY wrote: DearList, I ‘m trying to draw ONE table that summarize SEVERAL categorical variables according to one classification variable, say “sex”. The result would look like several contingency tables appended one to the other. All the variables belong to a data frame. The

Re: [R] Installing Package rgl - Compilation Fails

2007-02-20 Thread Duncan Murdoch
On 2/20/2007 9:44 AM, Rick Bilonick wrote: On Mon, 2007-02-19 at 15:11 -0600, Ranjan Maitra wrote: The error is different now. It now cannot find Xext library. Do a yum search on this and install that. yum provides libXext which will give you the package Xext which needs to be installed.

Re: [R] Reading Post-Script files

2007-02-20 Thread Roger Bivand
On Tue, 20 Feb 2007, Ralf Finne wrote: Hi everybody! Is there any way to read a postscrit file into R? See http://www.r-project.org/useR-2006/Slides/Murrell.pdf page 4, the grImport package, now on CRAN, with further notes on Paul Murrell's home page: http://www.stat.auckland.ac.nz/~paul/

Re: [R] Reading Post-Script files

2007-02-20 Thread Ted Harding
On 20-Feb-07 Ralf Finne wrote: Hi everybody! Is there any way to read a postscrit file into R? All the best to you Ralf Finne SYH University of Applied Sciences Vasa Finland Well, yes ... since a PostScript file is ASCII text you could use readline() ... but what you'd do with it after

Re: [R] summary polr

2007-02-20 Thread Michael Dewey
At 14:41 20/02/2007, you wrote: Please do not just reply to me, 1 - I might not know 2 - it breaks the threading Hi here there is an example extracted from polr help in MASS: The function could be: temp - function(form, dat) { house.plr - polr(formula = form,

[R] Use R source in .net (R Source in .net einbinden)

2007-02-20 Thread Martin
Hi! I would like to use an existing R-code in an .net project. Now I realize that there exists a DCOM interface which enables me to use the Statconnector object in my c# project. That way I can get the results of terms using the .evaluate() method. My question is: Is it somehow possible to

[R] R: Re: summary polr

2007-02-20 Thread Paolo Accadia
Hi all, The problem is that when you try to use the function summary of a polr object in a function, it does not work. The problem is not related to the formula or the structure of data involved. It is probably related to the use of the function vcov in the code of summary for polr, and the

Re: [R] summary polr

2007-02-20 Thread Prof Brian Ripley
That's not it (the function is 'coef' not 'coeff', and R can tell functions and lists apart). If you read the help page for polr you will see you could have used Hess=TRUE. It works then. THAT is why we needed an example, to see how you used the function. On Tue, 20 Feb 2007, Michael

[R] Mahalanobis distance and probability of group membership using Hotelling's T2 distribution

2007-02-20 Thread Mike White
I want to calculate the probability that a group will include a particular point using the squared Mahalanobis distance to the centroid. I understand that the squared Mahalanobis distance is distributed as chi-squared but that for a small number of random samples from a multivariate normal

[R] Help with xlab and ylab distance from axes

2007-02-20 Thread Michael Kubovy
Dear r-helpers, In basic graphics, I have a figure with x and y axes suppresed. I would like to move the xlab and the ylab closer to the axes. Do I have to use mtext()? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box

[R] testing slopes

2007-02-20 Thread Indermaur Lukas
Hello Instead of testing against 0 i would like to test regression slopes against -1. Any idea if there's an R script (package?) available. Thanks for any hint. Cheers Lukas °°° Lukas Indermaur, PhD student eawag / Swiss Federal Institute of Aquatic Science and Technology ECO -

Re: [R] summary polr

2007-02-20 Thread Paolo Accadia
Thank you very much Paolo Prof Brian Ripley [EMAIL PROTECTED] 20/02/07 4:00 PM That's not it (the function is 'coef' not 'coeff', and R can tell functions and lists apart). If you read the help page for polr you will see you could have used Hess=TRUE. It works then. THAT is why we needed

[R] Standardized residual variances in SEM

2007-02-20 Thread Mathieu d'Acremont
Hello, I'm using the sem package to do a confirmatory factor analysis on data collected with a questionnaire. In the model, there is a unique factor G and 23 items. I would like to calculate the standardized residual variance of the observed variables. Sem only gives the residual variance

Re: [R] Help with xlab and ylab distance from axes

2007-02-20 Thread Marc Schwartz
On Tue, 2007-02-20 at 11:31 -0500, Michael Kubovy wrote: Dear r-helpers, In basic graphics, I have a figure with x and y axes suppresed. I would like to move the xlab and the ylab closer to the axes. Do I have to use mtext()? Michael, You could set the first value in par(mgp) in the

Re: [R] Installing Package rgl - Compilation Fails - Summary

2007-02-20 Thread Rick Bilonick
Summarizing: I'm running R 2.4.1 on a current FC6 32-bit system. In order to have the rgl R package install, I needed to install both mesa-libGLU-devel (FC6 version is 6.5.1-9) and libXext-devel (FC6) rpm packages. Thanks to everyone who commented. Rick B.

Re: [R] testing slopes

2007-02-20 Thread Dimitris Rizopoulos
two options are to use an offset term or the linear.hypothesis() function from package car, e.g., y - rnorm(100, 2 - 1 * (x - runif(100, -3, 3)), 3) fit0 - lm(y ~ 1 + offset(-x)) fit1 - lm(y ~ x) anova(fit0, fit1) library(car) linear.hypothesis(fit1, c(x = -1)) I hope it helps.

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Charles C. Berry
On Tue, 20 Feb 2007, Federico Calboli wrote: Liaw, Andy wrote: I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Federico Calboli
Charles C. Berry wrote: This is a bit different than your original post (where it appeared that you were manipulating one row of a matrix at a time), but the issue is the same. As suggested in my earlier email this looks like a caching issue, and this is not peculiar to R. Viz.

Re: [R] Calculating the Sharpe ratio

2007-02-20 Thread AA
Hi Bernd, It seems to me that the sharpe function uses the diff to calculate the first differnce of the input which is a cumalative return series. This is consistant. see sharpe Basically you need the rate of returns ((priceFinal - Price Initial)/priceInitial) which you used. In your case r = 0,

Re: [R] interaction term and scatterplot3d

2007-02-20 Thread Patrick Giraudoux
Sorry to answer to myself. A solution was trivial with lattice... (as often !) library(lattice) modbusetmp-lm(IKA_buse ~ Ct *Cc,data=dtbuse) G1-cloud(IKA_buse~Ct*Cc,type=h,data=dtbuse) G2-cloud(IKA_buse~Ct*Cc,data=dtbuse) seqCc-seq(min(dtbuse$Cc),max(dtbuse$Cc),l=20)

Re: [R] Installing Package rgl - Compilation Fails - Summary

2007-02-20 Thread Ranjan Maitra
Hi Duncan, I don't know if this will list all the dependencies for your documentation, since Rick's error messages did not involve libraries and header files already installed by him for something else, perhaps. Just a thought. Ranjan On Tue, 20 Feb 2007 11:59:24 -0500 Rick Bilonick [EMAIL

[R] linux gplots install unhappy

2007-02-20 Thread Randy Zelick
Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be upgraded to 4.0). On windows I installed the package gplots without trouble, and it works fine. When I attempted to do the same on the unix computer, the following

Re: [R] Installing Package rgl - Compilation Fails - Summary

2007-02-20 Thread Duncan Murdoch
On 2/20/2007 1:11 PM, Ranjan Maitra wrote: Hi Duncan, I don't know if this will list all the dependencies for your documentation, since Rick's error messages did not involve libraries and header files already installed by him for something else, perhaps. No, but it's a start: I'm

Re: [R] linux gplots install unhappy

2007-02-20 Thread Aimin Yan
install gtools package firstly Aimin At 12:17 PM 2/20/2007, Randy Zelick wrote: gtools' __ R-help@stat.math.ethz.ch 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] linux gplots install unhappy

2007-02-20 Thread Benilton Carvalho
well, it's complaining because you don't have gtools installed. how about: install.packages(gplots, dep=T) ? b On Feb 20, 2007, at 1:17 PM, Randy Zelick wrote: Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be

[R] baseline fitters

2007-02-20 Thread Thaden, John J
I am pretty pleased with baselines I fit to chromatograms using the runquantile() function in caTools(v1.6) when its probs parameter is set to 0.2 and its k parameter to ~1/20th of n (e.g., k ~ 225 for n ~ 4500, where n is time series length). This ignores occasional low- side outliers, and,

Re: [R] linux gplots install unhappy

2007-02-20 Thread Marc Schwartz
On Tue, 2007-02-20 at 10:17 -0800, Randy Zelick wrote: Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be upgraded to 4.0). On windows I installed the package gplots without trouble, and it works fine. When I

Re: [R] User defined split function in rpart

2007-02-20 Thread Tobias Guennel
I have made some progress with the user defined splitting function and I got a lot of the things I needed to work. However, I am still stuck on accessing the node data. It would probably be enough if somebody could tell me, how I can access the original data frame of the call to rpart. So if the

Re: [R] linux gplots install unhappy

2007-02-20 Thread Prof Brian Ripley
On Tue, 20 Feb 2007, Marc Schwartz wrote: On Tue, 2007-02-20 at 10:17 -0800, Randy Zelick wrote: Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be upgraded to 4.0). On windows I installed the package gplots without

Re: [R] Installing Package rgl - Compilation Fails - Summary

2007-02-20 Thread Prof Brian Ripley
On Tue, 20 Feb 2007, Ranjan Maitra wrote: Hi Duncan, I don't know if this will list all the dependencies for your documentation, since Rick's error messages did not involve libraries and header files already installed by him for something else, perhaps. It will not, and most of this is

Re: [R] baseline fitters

2007-02-20 Thread Tuszynski, Jaroslaw W.
I am not surprised at slowness of runquantile, since it is trying to perform n=4500 partial sorts of k=225 elements. Here are some thoughts at speeding it up: 1) playing with different endrule settings can save some time, but usually results with undesirable effects at first and last 112 values.

Re: [R] printing intermediate lines while in a function

2007-02-20 Thread Bart Joosen
Thanks for al the tips, it was the readline() function who did the trick for me, so thanks for all of your input Kind Regards Bart Original message: snip But unfortunately R will do first the calculations and then afterwards return the strings. Is there a way around?

Re: [R] contextstack overflow

2007-02-20 Thread Prof Brian Ripley
On Tue, 20 Feb 2007, Steven Finch wrote: Hello! I written several implementations in R of Rémy's algorithm for generating random ordered strictly binary trees on 2n+1 vertices. One implementation involves manufacturing character strings like: X - list(0,list(0,0)) for the case n=2. If I

Re: [R] linux gplots install unhappy

2007-02-20 Thread Marc Schwartz
On Tue, 2007-02-20 at 18:59 +, Prof Brian Ripley wrote: On Tue, 20 Feb 2007, Marc Schwartz wrote: On Tue, 2007-02-20 at 10:17 -0800, Randy Zelick wrote: Hello all, I use R on both windows and a mainframe linux installation (RedHat enterprise 3.0, which they tell me is soon to be

Re: [R] Calculating the Sharpe ratio

2007-02-20 Thread Bernd Dittmann
Hi Mark, thanks for your email. I used your formula for cumul. returns and plugged them into sharpe: mysharpe - function(x){ + return(sharpe(cret(x), r=0, scale=1)) + } whereby cret is my cumul. returns function as defined by: cret function(x){ cumprod(diff(log(x))+1)-1 } For the index

Re: [R] Installing Package rgl - Compilation Fails - FreeBSD

2007-02-20 Thread Rainer Hurling
Duncan Murdoch schrieb: On 2/20/2007 1:11 PM, Ranjan Maitra wrote: Hi Duncan, I don't know if this will list all the dependencies for your documentation, since Rick's error messages did not involve libraries and header files already installed by him for something else, perhaps. No, but

Re: [R] Installing Package rgl - Compilation Fails - FreeBSD

2007-02-20 Thread Prof Brian Ripley
The problem is that rgl is apparently written for GNU make, and has (as shipped) ifdef MAKINGAGL [EMAIL PROTECTED]@ -Iext [EMAIL PROTECTED]@ else PKG_CPPFLAGS= -If:/R/R-2.4.1/src/extra/zlib -DHAVE_PNG_H -If:/R/R-2.4.1/src/gnuwin32/bitmap/libpng -Iext PKG_LIBS=-lgdi32 -lopengl32 -lglu32

[R] analysis of correlation matrices

2007-02-20 Thread ablukacz
Hello, I'm looking for a package in R that performs, analysis of correlation matrices: cross-classified by 2 factors. The orginal reference to this method is by CJ Brien Biometrica (1998) 75(3):469-76. THank you, Agnes - E. Agnes Richards, Ph.D.

Re: [R] Simplification of Generalised Linear mixed effects models using glmmPQL

2007-02-20 Thread Andrew Robinson
Hello Tom, the problem is because R has assumed that pop and rep are integers, not factor levels. Try: test - read.table(test.txt,header=T) sapply(test, class) test$pop - factor(test$pop) test$rep - factor(test$rep) then try fitting the models. Also, there has been substantial discussion

Re: [R] Installing Package rgl - Compilation Fails - FreeBSD

2007-02-20 Thread Duncan Murdoch
On 2/20/2007 4:45 PM, Prof Brian Ripley wrote: The problem is that rgl is apparently written for GNU make, and has (as shipped) ifdef MAKINGAGL [EMAIL PROTECTED]@ -Iext [EMAIL PROTECTED]@ else PKG_CPPFLAGS= -If:/R/R-2.4.1/src/extra/zlib -DHAVE_PNG_H

[R] Different gridlines per panel in xyplot

2007-02-20 Thread Rene Braeckman
In the example R script below, horizontal gray gridlines are drawn at y coordinates where the points are drawn with the code: panel.abline(h=y, v=xScale, col.line=gray) How do I change this so that the horizontal gray gridlines are drawn at y coordinates where the y labels are drawn? The

Re: [R] Different gridlines per panel in xyplot

2007-02-20 Thread Bernd Weiss
Am 20 Feb 2007 um 20:52 hat Rene Braeckman geschrieben: From: Rene Braeckman [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Date sent: Tue, 20 Feb 2007 20:52:29 -0800 Subject:[R] Different gridlines per panel in xyplot In the

Re: [R] Different gridlines per panel in xyplot

2007-02-20 Thread Rene Braeckman
Thanks for the reply. Trunc would only work when the truncated y values result in the desired y coordinates for the grid lines as in this simple data set. Since my real dataset contains many more points, it does not give a general solution. Rene -Original Message- From: Bernd Weiss

Re: [R] Different gridlines per panel in xyplot

2007-02-20 Thread Rene Braeckman
I solved my own problem. Suddenly remembered the list of very useful functions under Accessing Auxiliary Information During Plotting in the help pages. Here is the line that did the trick: panel.abline(h=yScale[[panel.number()]], v=xScale, col.line=gray) Rene -Original Message- From:

[R] Splom plot:how to plot with different symbols?

2007-02-20 Thread d. sarthi maheshwari
Hi, Kindly let me know if I posted a wrong question in the forum. I want to draw a splom plot with different symbols in plot. My command is as follows: splom(~ log10(splomData[2:3]), groups = programs, data = splomData, panel = panel.superpose, key = list(title = paste(splomLoop,Programs of Hog