Re: [R] Quick partitioning

2005-08-26 Thread Prof Brian Ripley
On Thu, 25 Aug 2005, Anna Oganyan wrote: Hello, I am quite new in R, and I have one problem: I have large d-dimensional data sets (d=2, 3, 6, 10). I would like to divide the d-dim space into n (n may be 10, but better some larger number, for example 20) equally sized d-dim hypercubes and

Re: [R] Fitting data to gaussian distributions

2005-08-26 Thread Prof Brian Ripley
See also the book MASS, the one fitdistr supports. On Thu, 25 Aug 2005, Luis Gracia wrote: Hi again, self-answered. I took a breath and started another google search, this time more successful. I found the following packages in case somebody has the same question: nor1mix wle mixdist

Re: [R] question about coxph (was covariance matrix under null)

2005-08-26 Thread Prof Brian Ripley
You will need to tell us of _what_ you want the covariance matrix and what you mean by the `null hypothesis': coxph does estimation, not testing. If you want the covariance matrix of the parameter estimates, see vcov(), which has a coxph method. On Thu, 25 Aug 2005, Devarajan, Karthik wrote:

Re: [R] Help about R

2005-08-26 Thread Martin Maechler
Don == Don MacQueen [EMAIL PROTECTED] on Thu, 25 Aug 2005 08:11:42 -0700 writes: Don Also, for the three dimensional graphic, Don help.search(3d) Don will lead to a reference to the cloud() function in the lattice package. Don I don't remember if the lattice package is

Re: [R] A. Mani : Tapply

2005-08-26 Thread Petr Pikal
__ 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

[R] learning decision trees with one's own scoring functins

2005-08-26 Thread zhihua li
Hi netters, I want to learn a decision tree from a series of instances (learning data). The packages tree or rpart can do this quite well, but the scoring functions (splitting criteria) are fixed in these packages, like gini or something. However, I'm going to use another scoring function.

Re: [R] learning decision trees with one's own scoring functins

2005-08-26 Thread Philippe Grosjean
Hello, You have access to the C code of the function in the *source* of the package. You can modify it and recompile the package and function (its better then to give a different name!). Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (

[R] Truncate levels to use randomForest

2005-08-26 Thread Martin Lam
Hi, I will explain my problem with this example: library(randomForest) # load the iris plant data set dataset - iris numberarray - array(1:nrow(dataset), nrow(dataset), 1) # include only instances with Species = setosa or virginica indices - t(numberarray[(dataset$Species == setosa |

Re: [R] A. Mani : Tapply

2005-08-26 Thread Petr Pikal
Hi PLEASE do read the posting guide! ** On 25 Aug 2005 at 20:28, A Mani wrote: Hello, Is it safe to use tapply when the result will be of dim 2 x 1 or more ? In my PC R crashes. or gave you an error message? I tried this

Re: [R] Code in lattice::dotplot function.

2005-08-26 Thread Ernesto Jardim
Deepayan Sarkar wrote: On 8/25/05, ernesto [EMAIL PROTECTED] wrote: Hi, I'm trying to understand the code of lattice functions so that I can write some S4 methods using lattice. The following code is a snipet of dotplot that is reused in several other functions. I don't understand why this

Re: [R] chisq.,test`

2005-08-26 Thread Gavin Simpson
On Fri, 2005-08-26 at 18:15 +1000, Stephen Choularton wrote: Hi I am trying to do this: I get no syntax error on R 2.1.1-patched. I do get an error though: Error in chisq.test(c(11, 13, 12, 18, 21, 43, 15, 12, 9, 10, 5, 28, 22, : probabilities must sum to 1. Which leads us to

[R] chisq.,test`

2005-08-26 Thread Stephen Choularton
Hi I am trying to do this: chisq.test(c(11, 13, 12, 18, 21, 43, 15, 12, 9, 10, 5, 28, 22, 11, 15, 11, 18, 28, 16, 8, 15, 19, 44, 18, 11, 23, 15, 23, 2, 5, 4, 14, 3, 22, 9, 0, 6, 19, 15, 32, 3, 16, 14, 10, 24, 16, 24, 31, 29, 28, 16, 26, 11, 11, 4, 17, 16, 13, 20, 26, 16, 19, 34, 19, 17, 14,

Re: [R] histogram method for S4 class.

2005-08-26 Thread Ernesto Jardim
Deepayan Sarkar wrote: On 8/24/05, ernesto [EMAIL PROTECTED] wrote: Hi, I'm trying to develop an histogram method for a class called FLQuant which is used by the package FLCore (http://flr-project.org). FLQuant is an extension to array. There is an as.data.frame method that coerces flquant

[R] Cumulative Function

2005-08-26 Thread Mark Miller
I was wandering if anyone cold advise me on a good algorithm to turn a set of data from its original for into its cumulative form. I have written a piece of code that takes the data and does essentially what a histogram function would do, except add to the new bin the sum in the previous bin.

Re: [R] chisq.,test`

2005-08-26 Thread Ted Harding
On 26-Aug-05 Stephen Choularton wrote: Hi I am trying to do this: chisq.test(c(11, 13, 12, 18, 21, 43, 15, 12, 9, 10, 5, 28, 22, 11, 15, [...] 7, 54, 34, 92, 27, 24, 19, 13, 16, 22, 18, 15, 19, 17, 31, 14, 32), p=c(0.0016, 0.002752, 0.001728, 0.0016, 0.001792, 0.005953, 0.006081,

Re: [R] Cumulative Function

2005-08-26 Thread Sean Davis
Will ?cumsum help? Sean On 8/26/05 5:15 AM, Mark Miller [EMAIL PROTECTED] wrote: I was wandering if anyone cold advise me on a good algorithm to turn a set of data from its original for into its cumulative form. I have written a piece of code that takes the data and does essentially what a

Re: [R] learning decision trees with one's own scoring functins

2005-08-26 Thread Prof Brian Ripley
Please do study the packages you mention a great deal more carefully before posting such negative remarks about them. In particular, rpart is already fully user-extensible (and comes with a worked example), and both packages are supplied in source code on CRAN. On Fri, 26 Aug 2005, zhihua li

[R] Help: lda predict

2005-08-26 Thread Shengzhe Wu
Hello, I use lda (package: MASS) to obtain a lda object, then want to employ this object to do the prediction for the new data like below: predict(object, newdata, dimen=1, method=c(plug-in, predictive, debiased)) What is the exact difference among the three methods? What is the difference of

[R] Modelling Financial Time Series with S-PLUS - Adv. Course 20th Sept '05

2005-08-26 Thread Kathy Kiely
Insightful are now taking bookings for the Advanced Time Series Modelling course to be held at Carlton Terrace in London SW1 on 20th September. Advanced workshop Extract for Financial Time Series Modelling : The Advanced Time Series Course focuses on the most up to date theory and its

Re: [R] Help: lda predict

2005-08-26 Thread Prof Brian Ripley
On Fri, 26 Aug 2005, Shengzhe Wu wrote: I use lda (package: MASS) to obtain a lda object, then want to employ this object to do the prediction for the new data like below: predict(object, newdata, dimen=1, method=c(plug-in, predictive, debiased)) That is not how you call it: when a

[R] Matrix oriented computing

2005-08-26 Thread Sigbert Klinke
Hi, I want to compute the quantiles of Chi^2 distributions with different degrees of freedom like x-cbind(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df-rbind(1:100) m-qchisq(x,df) and hoped to get back a length(df) times length(x) matrix with the quantiles. Since

[R] Help: lda predict

2005-08-26 Thread Shengzhe Wu
Thanks for your reply. Actually I called function as below. p1 = predict(object, newdata, dimen=1) p2 = predict(object, newdata, dimen=1, method=debiased) p3 = predict(object, newdata, dimen=1, method=predictive) The MAP classification of prediction results by any method are the same. I know

Re: [R] Matrix oriented computing

2005-08-26 Thread Achim Zeileis
On Fri, 26 Aug 2005 14:44:10 +0200 Sigbert Klinke wrote: Hi, I want to compute the quantiles of Chi^2 distributions with different degrees of freedom like x-cbind(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df-rbind(1:100) m-qchisq(x,df) and hoped to get back

Re: [R] Matrix oriented computing

2005-08-26 Thread Marc Schwartz
On Fri, 2005-08-26 at 14:44 +0200, Sigbert Klinke wrote: Hi, I want to compute the quantiles of Chi^2 distributions with different degrees of freedom like x-cbind(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df-rbind(1:100) m-qchisq(x,df) and hoped to get back

Re: [R] Help: lda predict

2005-08-26 Thread Prof Brian Ripley
On Fri, 26 Aug 2005, Shengzhe Wu wrote: Thanks for your reply. Actually I called function as below. p1 = predict(object, newdata, dimen=1) p2 = predict(object, newdata, dimen=1, method=debiased) p3 = predict(object, newdata, dimen=1, method=predictive) So why did you say something

Re: [R] Matrix oriented computing

2005-08-26 Thread Patrick Burns
I believe that the following is what you want: x - c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) dof - 1:100 ans - outer(x, dof, qchisq) dimnames(ans) - list(x, dof) Note that 'df' is not a very auspicious name for an object since it is the name of a function. Patrick

Re: [R] Help: lda predict

2005-08-26 Thread Shengzhe Wu
I compared posterior of these three prediction results, they are a little different. The book you mentioned should be Modern Applied Statistics with S. 4th edition. But this book has been borrowed out from our univeristy library by someone else, and I have checked the book Pattern Recognition and

Re: [R] Help: lda predict

2005-08-26 Thread Prof Brian Ripley
On Fri, 26 Aug 2005, Shengzhe Wu wrote: I compared posterior of these three prediction results, they are a little different. The book you mentioned should be Modern Applied Statistics with S. 4th edition. But this book has been borrowed out from our univeristy library by someone else, So

Re: [R] covariance matrix under null

2005-08-26 Thread Thomas Lumley
On Thu, 25 Aug 2005, Devarajan, Karthik wrote: Hello I am fitting a Cox PH model using the function coxph(). Does anyone know how to obtain the estimate of the covariance matrix under the null hypothesis. The function coxph.detail() does not seem to be useful for this purpose. You can

Re: [R] R-help Digest, Vol 30, Issue 26

2005-08-26 Thread Jean-Marc Ottorini
Dear R helpers, For me ( i.e. R 2.1.1 on Mac OS X), using trellis.device (postscript, onefile = F, etc ... with the lattice library within a R function works fine to obtain the desired graph as an EPS file , provided that : 1) the command dev.off() is not included in this function

Re: [R] Matrix oriented computing

2005-08-26 Thread Peter Dalgaard
Marc Schwartz [EMAIL PROTECTED] writes: x - c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df - c(1:100) mat - sapply(x, qchisq, df) dim(mat) [1] 100 11 str(mat) num [1:100, 1:11] 3.93e-05 1.00e-02 7.17e-02 2.07e-01 4.12e-01 ... outer() is

Re: [R] Shutting down a trellis plot (was R-help Digest, Vol 30, Issue 26)

2005-08-26 Thread Prof Brian Ripley
I suspect you have not print()-ed your graphics, see FAQ Q7.22. It is then possible to include dev.off() within the function. E.g. testit - function(fn = test.eps) { trellis.device(postscript, file=fn, onefile = FALSE, horizontal=FALSE) print(stripplot(voice.part ~ jitter(height), data =

[R] passing arguments from nnet to optim

2005-08-26 Thread Tarca, Adi
Hi everyone, According to R reference manual, the nnet function uses the BFGS method of optim to optimize the neural network parameters. I would like, when calling the function nnet to tell the optim function not to produce the tracing information on the progress of the optimization, or at least

Re: [R] Plotting nls

2005-08-26 Thread Ben Rich
To get nice looking plots you can use trellis plots from the lattice package. First you need: library(lattice) Then you can define a custom panel function that will overlay the fitted curve on top of the data points in a different color (you just need to do this once; the fit you want plotted

[R] basic anova and t-test question

2005-08-26 Thread Arne.Muller
Hello, I'm posting this to receive some comments/hints about a rather statistical than R-technical question ... . In an anova of a lme factor SSPos11 shows up non-significant, but in the t-test of the summay 2 of the 4 levels (one for constrast) are significant. See below for some truncated

Re: [R] Matrix oriented computing

2005-08-26 Thread Marc Schwartz (via MN)
On Fri, 2005-08-26 at 15:25 +0200, Peter Dalgaard wrote: Marc Schwartz [EMAIL PROTECTED] writes: x - c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df - c(1:100) mat - sapply(x, qchisq, df) dim(mat) [1] 100 11 str(mat) num [1:100,

Re: [R] passing arguments from nnet to optim

2005-08-26 Thread Prof Brian Ripley
On Fri, 26 Aug 2005, Tarca, Adi wrote: Hi everyone, According to R reference manual, the nnet function uses the BFGS method of optim to optimize the neural network parameters. What the help page says is ...: arguments passed to or from other methods. That means methods of nnet().

[R] problem with certain data sets when using randomForest

2005-08-26 Thread Martin Lam
Hi, Since I've had no replies on my previous post about my problem I am posting it again in the hope someone notice it. The problem is that the randomForest function doesn't take datasets which has instances only containing a subset of all the classes. So the dataset with instances that either

Re: [R] Matrix oriented computing

2005-08-26 Thread Prof Brian Ripley
Try profiling. Doing this many times to get an overview, e.g. for sapply with df=1:1000: % self% total self secondstotalsecondsname 98.26 6.78 98.26 6.78 FUN 0.58 0.04 0.58 0.04 unlist 0.29 0.02

Re: [R] Matrix oriented computing

2005-08-26 Thread John Fox
Dear Mark, For that matter, the loop isn't a whole a slower (on my 3GHz Win XP system): x - c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df - 1:1000 system.time(mat - sapply(x, qchisq, df), gcFirst = TRUE) [1] 0.08 0.00 0.08 NA NA mat - matrix(0, 1000, 11)

Re: [R] Matrix oriented computing

2005-08-26 Thread Marc Schwartz (via MN)
Prof. Ripley, Excellent point. Neither sapply() nor outer() are the elephant in the room in this situation. On Fri, 2005-08-26 at 16:55 +0100, Prof Brian Ripley wrote: Try profiling. Doing this many times to get an overview, e.g. for sapply with df=1:1000: % self%

[R] parts of data frames: subset vs. [-c()]

2005-08-26 Thread Stefan Th. Gries
Dear all I have a problem with splitting up a data frame called ReVerb: » str(ReVerb) `data.frame': 92713 obs. of 16 variables: $ CHILD: Factor w/ 7 levels ABE,ADA,EVE,..: 1 1 1 1 1 1 1 1 1 1 ... $ AGE : Factor w/ 484 levels 1;06.00,1;06.16,..: 43 43 43 99 99 99 99 99 99 99 ... $

Re: [R] problem with certain data sets when using randomForest

2005-08-26 Thread Prof Brian Ripley
Look at ?[.factor: finaldataset$Species - finaldataset$Species[,drop=TRUE] solves this. On Fri, 26 Aug 2005, Martin Lam wrote: Hi, Since I've had no replies on my previous post about my problem I am posting it again in the hope someone notice it. The problem is that the

Re: [R] Matrix oriented computing

2005-08-26 Thread Gabor Grothendieck
On 8/26/05, Marc Schwartz (via MN) [EMAIL PROTECTED] wrote: On Fri, 2005-08-26 at 15:25 +0200, Peter Dalgaard wrote: Marc Schwartz [EMAIL PROTECTED] writes: x - c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9, 0.95, 0.975, 0.99, 0.995) df - c(1:100) mat - sapply(x, qchisq,

Re: [R] parts of data frames: subset vs. [-c()]

2005-08-26 Thread Peter Dalgaard
Stefan Th. Gries [EMAIL PROTECTED] writes: Dear all I have a problem with splitting up a data frame called ReVerb: » str(ReVerb) `data.frame': 92713 obs. of 16 variables: $ CHILD: Factor w/ 7 levels ABE,ADA,EVE,..: 1 1 1 1 1 1 1 1 1 1 ... $ AGE : Factor w/ 484 levels

[R] class 'named'

2005-08-26 Thread Phineas Campbell
I'm working through the examples in Venables and Ripley in the 'New-style Classes' chapter. On a call to representation, in the lda example, it is unable to find the class named. Is the class named defined anywhere? I've loaded the library methods but this hasn't helped. Phineas Campbell

[R] Help in Compliling user -defined functions in Rpart

2005-08-26 Thread Luwis Tapiwa Diya
I have been trying to write my own user defined function in Rpart.I imitated the anova splitting rule which is given as an example.In the work I am doing ,I am calculating the concentration index(ci) ,which is in between -1 and +1.So my deviance is given by abs(ci)*(1-abs(ci)).Now when I run rpart

[R] Unpaste Problem

2005-08-26 Thread A Mani
Hello, Easy ways to unpaste? xp - paste(x2, x3) # x2, x3 are two non-numeric columns. . . xfg - data.frame(xp,sc1, sc2, sc3) # sc1,sc2, sc3 are numeric cols. I want xp to be split up to form a new dataframe of the form (x3, sc1, sc2, sc3). IMPORTANT

[R] compare c-index of two logistic models using rcorrp.senc() of the Hmisc library

2005-08-26 Thread Osman Al-Radi
Dear R-help, Would it be appropriate to do the following to calculate a p-value for the difference between c-ind of x1 and c-inx of x2 using the output from rcorrp.senc() r-rcorrp.senc(x1,x1,y) pValue-1-pnorm((r[11]-r[12])/(r[2]/r[5])*1.96) Osman O. Al-Radi, MD, MSc, FRCSC Chief Resident,

Re: [R] compare c-index of two logistic models using rcorrp.senc() of the Hmisc library

2005-08-26 Thread Frank E Harrell Jr
Osman Al-Radi wrote: Dear R-help, Would it be appropriate to do the following to calculate a p-value for the difference between c-ind of x1 and c-inx of x2 using the output from rcorrp.senc() r-rcorrp.senc(x1,x1,y) pValue-1-pnorm((r[11]-r[12])/(r[2]/r[5])*1.96) Osman O.

Re: [R] parts of data frames: subset vs. [-c()]

2005-08-26 Thread Prof Brian Ripley
Are there NAs in the variable? SYNTAX==Ditrans and SYNTAX!=Ditrans are not mutually exclusive. On Fri, 26 Aug 2005, Stefan Th. Gries wrote: Dear all I have a problem with splitting up a data frame called ReVerb: » str(ReVerb) `data.frame': 92713 obs. of 16 variables: $ CHILD: Factor

Re: [R] class 'named'

2005-08-26 Thread Prof Brian Ripley
That is one of the S4 vs R differences. See the complements. On Fri, 26 Aug 2005, Phineas Campbell wrote: I'm working through the examples in Venables and Ripley in the 'New-style Classes' chapter. On a call to representation, in the lda example, it is unable to find the class named. Is

Re: [R] Help in Compliling user -defined functions in Rpart

2005-08-26 Thread Prof Brian Ripley
On Fri, 26 Aug 2005, Luwis Tapiwa Diya wrote: I have been trying to write my own user defined function in Rpart.I imitated the anova splitting rule which is given as an example.In the work I am doing ,I am calculating the concentration index(ci) ,which is in between -1 and +1.So my deviance

Re: [R] problem with certain data sets when using randomForest

2005-08-26 Thread Martin Lam
Thank you for this and earlier help Mr. Ripley. Martin --- Prof Brian Ripley [EMAIL PROTECTED] wrote: Look at ?[.factor: finaldataset$Species - finaldataset$Species[,drop=TRUE] solves this. On Fri, 26 Aug 2005, Martin Lam wrote: Hi, Since I've had no replies on my

[R] Pseudo-Voigt fit

2005-08-26 Thread ppancoska
Hi, I am sorry for this question, but I am trying to speed up an application I will need to fit many x-y data sets (input from text files) to 4-parameter Pseudo-Voigt peak function. Until now I used SigmaPlot macro to do it (enclosed just in case...) peaksign(q) = if(total(q)q[1], 1, -1)

Re: [R] Unpaste Problem

2005-08-26 Thread Marc Schwartz (via MN)
On Fri, 2005-08-26 at 22:39 +0530, A Mani wrote: Hello, Easy ways to unpaste? xp - paste(x2, x3) # x2, x3 are two non-numeric columns. . . xfg - data.frame(xp,sc1, sc2, sc3) # sc1,sc2, sc3 are numeric cols. I want xp to be split up to form a

[R] Creating factors from continuous variables

2005-08-26 Thread David James
What is the quickest way to create many categorical variables (factors) from continuous variables? This is the approach that I have used: # create sample data N - 20 x - runif(N,0,1) # setup ranges to define categories x.a - (x = 0.0) (x 0.4) x.b - (x = 0.4) (x 0.5) x.c - (x = 0.5) (x

Re: [R] Creating factors from continuous variables

2005-08-26 Thread Berton Gunter
?cut -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David James

Re: [R] Creating factors from continuous variables

2005-08-26 Thread Prof Brian Ripley
?cut This is in `An Introduction to R', the manual which ships with R and basic reading. On Fri, 26 Aug 2005, David James wrote: What is the quickest way to create many categorical variables (factors) from continuous variables? This is the approach that I have used: # create sample data

Re: [R] Unpaste Problem

2005-08-26 Thread Gabor Grothendieck
On 8/26/05, A Mani [EMAIL PROTECTED] wrote: Hello, Easy ways to unpaste? xp - paste(x2, x3) # x2, x3 are two non-numeric columns. . . xfg - data.frame(xp,sc1, sc2, sc3) # sc1,sc2, sc3 are numeric cols. I want xp to be split up to form a new

[R] zoo, zooreg, ISOdatetime

2005-08-26 Thread David James
I create a zooreg object that runs from Jan-1-2002 0:00 to Jun-1-2005 0:00... regts.start = ISOdatetime(2002, 1, 1, hour=0, min=0, sec=0, tz=) regts.end = ISOdatetime(2005, 6, 1, hour=0, min=0, sec=0, tz=) regts.zoo - zooreg( NA, regts.start, regts.end, deltat=3600 ) Upon inspection:

[R] PLSR: model notation and reliabilities

2005-08-26 Thread I.Ioannou
I'm new in both R and statistics. I did my homework, I tried the archives and whatever I managed to get from the sources, but still I need assistance with the plsr package. I have a model with 2 core determinants D1 and D2, made by 3 indicators each (D1a,D1b,D1c and so on). Also I have 2

[R] ARIMA (seasonal) backcasting interpolation

2005-08-26 Thread David James
Thanks for everyone's help with zoo -- I think I've got my data set ready. (The data consists of surface weather temperatures, from 2002 to 2005, one observation per hour. Some values are missing... i.e. NA) I have three goals: GOAL #1:Get the data in proper time series form, preserving

Re: [R] How to add values on the axes of the 3D bi-variable lrm fit?

2005-08-26 Thread Spencer Graves
I have not seen a reply to this, so I will offer a few comments. 1. I haven't used lrm, but I assume you are referring to the copy in the Design package; I surmised that from reviewing RSiteSearch(lrm). 2. I installed Design and learned that I also needed

Re: [R] ARIMA (seasonal) backcasting interpolation

2005-08-26 Thread Gabor Grothendieck
On 8/26/05, David James [EMAIL PROTECTED] wrote: Thanks for everyone's help with zoo -- I think I've got my data set ready. (The data consists of surface weather temperatures, from 2002 to 2005, one observation per hour. Some values are missing... i.e. NA) I have three goals: GOAL #1:Get

[R] better than sapply

2005-08-26 Thread Omar Lakkis
I have the following two mapping data frames (r) and (h). I want to fill teh value of r$seid with the value of r$seid where r$cid==h$cid. I can do it with sapply as such: r$seid = sapply(r$cid, function(cid) h[h$cid==cid,]$seid) Is ther a better (faster) way to do this? r -

Re: [R] better than sapply

2005-08-26 Thread Gabor Grothendieck
I don't know if its faster but you could try timing this to find out: r$seid - merge(h, r, by = cid)[,2] On 8/27/05, Omar Lakkis [EMAIL PROTECTED] wrote: I have the following two mapping data frames (r) and (h). I want to fill teh value of r$seid with the value of r$seid where r$cid==h$cid.