Re: [R] vector-factor operation

2006-04-14 Thread Berwin A Turlach
G'day Murray, MJ == Murray Jorgensen [EMAIL PROTECTED] writes: MJ I found myself wanting to average a vector [vec] within each MJ level of a factor [Fac], returning a vector of the same length MJ as vec. I presume that the vector that you want as result should not just have the same

Re: [R] Guidance on step() with large dataset (750K) solicited...

2006-04-14 Thread Prof Brian Ripley
On Thu, 13 Apr 2006, roger koenker wrote: Jeff, I don't know whether this is likely to be feasible, but if you could replace calls to lm() with calls to a sparse matrix version of lm() either slm() in SparseM or something similar in Matrix, then I would think that you should safe from

Re: [R] another memory size question

2006-04-14 Thread Prof Brian Ripley
On Fri, 14 Apr 2006, Alexander Nervedi wrote: Hi. I am having trouble figuring this out. Please help if you know what I am goffing up on. rm(list=ls(all=TRUE)) dat-expand.grid(village.code = c(1,2,3), household.id = 1:99, member.id = 1:41, year.code = 75:85, DOI = 1:366) Error: cannot

Re: [R] Vector

2006-04-14 Thread Petr Pikal
Hi On 13 Apr 2006 at 19:33, Gabor Csardi wrote: Date sent: Thu, 13 Apr 2006 19:33:30 -0400 From: Gabor Csardi [EMAIL PROTECTED] To: Barbora Kocúrová [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject:Re:

Re: [R] another very simple loop question

2006-04-14 Thread Petr Pikal
Hi What about some example data? I presume you could use some apply, tapply, aggregate or similar function but without knowing what you **really** want to do and how your previous attempts failed it is hard to give any definite answer. e.g. mydf-data.frame(year=sample(1:4,100,rep=T),

Re: [R] vector-factor operation

2006-04-14 Thread Petr Pikal
Hi vec-runif(100) fac-factor(sample(letters[1:4],100, rep=T)) tap-tapply(vec, fac, mean) new.vec-tap[fac] lm1 - lm(vec ~ fac) all.equal(as.numeric(predict(lm1)),as.numeric(new.vec)) [1] TRUE HTH Petr On 14 Apr 2006 at 17:46, Murray Jorgensen wrote: Date sent: Fri, 14 Apr 2006

Re: [R] Plotting positions in qqnorm?

2006-04-14 Thread David Scott
On Thu, 13 Apr 2006, Spencer Graves wrote: Do you know of a reference that discusses alternative choices for plotting positions for a normal probability plot? The documentation for qqnorm says it calls ppoints, which returns qnorm((1:m-a)/(m+1-2*a)) with a = ifelse(n=10, 3/8, 1/2)?

[R] Getting SVM minimized function value

2006-04-14 Thread pau carre
Hello, I have been searching a way to get the resulting optimized function value of a trained SVM model (svm from the package e1071) but I have not succeed. Does anyone knows a way to get that value? Pau __ R-help@stat.math.ethz.ch mailing list

Re: [R] vector-factor operation

2006-04-14 Thread Gabor Grothendieck
Look at ?ave ave(vec, Fac) ave(vec, Fac, FUN = mean) # same ave(vec, Fac, FUN = sd) On 4/14/06, Murray Jorgensen [EMAIL PROTECTED] wrote: I found myself wanting to average a vector [vec] within each level of a factor [Fac], returning a vector of the same length as vec. After a while I

Re: [R] Plotting positions in qqnorm?

2006-04-14 Thread Prof Brian Ripley
On Fri, 14 Apr 2006, David Scott wrote: On Thu, 13 Apr 2006, Spencer Graves wrote: Do you know of a reference that discusses alternative choices for plotting positions for a normal probability plot? The documentation for qqnorm says it calls ppoints, which returns

[R] suse 10.0

2006-04-14 Thread louis homer
I downloaded the free CD's and installed Suse 10.0. When I tried to install the latest RPM for R, the Yast installer complained that two files were missing. I was told that I can install from the internet, and started the process, but found I must supply the name of the server and the name of

[R] Dotplot x-axis

2006-04-14 Thread Michael Kubovy
Here's a small dataset: type - c('hierarchical','partial','single','complete','single +hierarchical','single+partial','partial+hierarchical','single+partial +hierarchical') freq - c(1455,729,688,65,29,28,16,17) lodds - log(freq/(3027 - freq)) dotplot(type~lodds) I would like to have the x-axis

Re: [R] Penalized Splines as BLUPs using lmer?

2006-04-14 Thread Doran, Harold
Me, opaque (it is rare that I say too little). Well, your assumption below is correct. This structure assumes a general covariance matrix for the random effects. As for the documentation, it is rather sparse at this time. There are really two places to look. One would be the vignette in the

Re: [R] Dotplot x-axis

2006-04-14 Thread Dimitris Rizopoulos
maybe something like: dotplot(type ~ lodds, scales = list(x = list(at = -5:0, labels = round(plogis(-5:0), 3 could do the trick; I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address:

[R] R: Dotplot x-axis

2006-04-14 Thread Guazzetti Stefano
Take a look at the scales argument in dotpolot. Maybe you need something like: position-exp(-5:0)/(1+exp(-5:0)) dotplot(type~freq/(3027-freq), scales=list(x=list(log=T, at=position, lab=round(position, 3))) ) Stefano -Messaggio originale- Da: [EMAIL PROTECTED]

Re: [R] suse 10.0

2006-04-14 Thread Leon
louis homer [EMAIL PROTECTED] writes: I downloaded the free CD's and installed Suse 10.0. When I tried to install the latest RPM for R, the Yast installer complained that two files were missing. I was told that I can install from the internet, and started the process, but found I must

[R] The object argument of NextMethod.

2006-04-14 Thread ronggui
My question is when the object argument of NexthMethod be used? In the following example, weather object argument is used will not affects the result. ### foo=function(x) {UseMethod(foo)} foo.cls1=function(x) { x=x+1;class(x)-ncls NextMethod() } foo.ncls=function(x) { cat(ncls\n) }

Re: [R] The object argument of NextMethod.

2006-04-14 Thread Gabor Grothendieck
In section 5.5 of the language manual it says: It is important to realize that the choice of the next method depends on the current values of .Generic and .Class and not on the object. So changing the object in a call to NextMethod affects the arguments received by the next method but does not

Re: [R] Dotplot x-axis

2006-04-14 Thread Michael Kubovy
I asked: Here's a small dataset: type - c('hierarchical','partial','single','complete','single +hierarchical','single+partial','partial+hierarchical','single +partial +hierarchical') freq - c(1455,729,688,65,29,28,16,17) lodds - log(freq/(3027 - freq)) dotplot(type~lodds) I would like

Re: [R] vector-factor operation

2006-04-14 Thread Thomas Lumley
On Fri, 14 Apr 2006, Murray Jorgensen wrote: I found myself wanting to average a vector [vec] within each level of a factor [Fac], returning a vector of the same length as vec. After a while I realised that lm1 - lm(vec ~ Fac) fitted(lm1) did what I want. But there must be another way

Re: [R] The object argument of NextMethod.

2006-04-14 Thread ronggui
在 06-4-14,Gabor Grothendieck[EMAIL PROTECTED] 写道: In section 5.5 of the language manual it says: It is important to realize that the choice of the next method depends on the current values of .Generic and .Class and not on the object. So changing the object in a call to NextMethod affects the

[R] R: On using gam(gam).

2006-04-14 Thread Liu Song
Dear R users, I am using R-function gam(gam) to fit additive models, more specifically partially linear models. Say, Y~x1+x2+s(z,df=d). Is there a way to extract the smoother matrix for the smoothing term z, or is there a way to extract the overall hat matrix H such that Y_hat=HY. Thank you in

[R] how to count the columns of a data.frame

2006-04-14 Thread giacomo moro
Hi, I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. Can someone tell me how to do it? My best regards, Giacomo Moro - [[alternative HTML version deleted]]

Re: [R] editor for Ubuntu

2006-04-14 Thread Ramón Casero Cañas
camille wrote: I am new on Ubuntu. I would like to use R, but I tried Kate and Scite. The first one keeps trying to use KDE applications,while the other does not understand the language. I have searched for another editor for hours, in vain. Which editor should work with Ubuntu? I use

Re: [R] how to count the columns of a data.frame

2006-04-14 Thread Ramón Casero Cañas
giacomo moro wrote: I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. Can someone tell me how to do it? ncol(data.frame) -- Ramón Casero Cañas http://www.robots.ox.ac.uk/~rcasero/wiki http://www.robots.ox.ac.uk/~rcasero/blog

Re: [R] how to count the columns of a data.frame

2006-04-14 Thread ronggui
da-data.frame(x=rnorm(10),y=rnorm(10)) ncol(da) [1] 2 or dim(da)[2] [1] 2 2006/4/15, giacomo moro [EMAIL PROTECTED]: Hi, I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. Can someone tell me how to do it? My best regards,

Re: [R] how to count the columns of a data.frame

2006-04-14 Thread Chuck Cleland
?ncol ncol(data.frame(x=-1, y=0, z=1)) [1] 3 giacomo moro wrote: Hi, I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. Can someone tell me how to do it? My best regards, Giacomo Moro

Re: [R] how to count the columns of a data.frame

2006-04-14 Thread Berton Gunter
Hi, I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. ... If you knew how to count the rows, you would have known about nrow which has the same man page as ncol. Also help.search('number of rows') would have immediately given you your

Re: [R] editor for Ubuntu

2006-04-14 Thread Ro
Or you can try JGR, http://stats.math.uni-augsburg.de/JGR/. A nice unified Graphical User Interface for R with integrated editor. à bientôt...Rod. On 13/04/06, camille [EMAIL PROTECTED] wrote: Hello, I am new on Ubuntu. I would like to use R, but I tried Kate and Scite. The first one

Re: [R] The object argument of NextMethod.

2006-04-14 Thread Prof Brian Ripley
On Fri, 14 Apr 2006, ronggui wrote: My question is when the object argument of NexthMethod be used? Looking at the C code, I don't think it is. But look at do_nextmethod in src/main/objects.c yourself. Note that in your examples it would not make any difference as 'x' is re-evaluated in

Re: [R] how to count the columns of a data.frame

2006-04-14 Thread David Howell
That was not a very helpful reply to someone who asked a question. He could be counting the rows by asking for the length of a full variable in that data frame, and not be aware of nrow(x). And one could know about nrow() without knowing about its page in the manual.. There is no need to jump all

[R] Adding values to top of bars in barchart

2006-04-14 Thread Eric Archer
Given the following data frame (freq.sp), str(freq.sp) `data.frame': 42 obs. of 4 variables: $ behav : Factor w/ 6 levels approach,bowride,..: 1 1 1 1 1 1 1 2 2 2 ... $ species: Factor w/ 7 levels COAST_SPOT,EAST_SPINR,..: 1 2 3 4 5 6 7 1 2 3 ... $ n : int 193 194 563 357 570 369

Re: [R] The object argument of NextMethod.

2006-04-14 Thread Gabor Grothendieck
On 4/14/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Fri, 14 Apr 2006, ronggui wrote: My question is when the object argument of NexthMethod be used? Looking at the C code, I don't think it is. But look at do_nextmethod in src/main/objects.c yourself. Note that in your examples it

Re: [R] Adding values to top of bars in barchart

2006-04-14 Thread Deepayan Sarkar
On 4/14/06, Eric Archer [EMAIL PROTECTED] wrote: Given the following data frame (freq.sp), str(freq.sp) `data.frame': 42 obs. of 4 variables: $ behav : Factor w/ 6 levels approach,bowride,..: 1 1 1 1 1 1 1 2 2 2 ... $ species: Factor w/ 7 levels COAST_SPOT,EAST_SPINR,..: 1 2 3 4 5 6

Re: [R] Questions on formula in princomp

2006-04-14 Thread Sasha Pustota
Gabor Grothendieck [EMAIL PROTECTED] wrote: Sasha Pustota [EMAIL PROTECTED] wrote: ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) lir - data.frame(log(ir)) names(lir) - c(a,b,c,d) I'm trying to understand the meaning of expressions like ~ a+b+c+d, used with princomp, e.g. princomp(~

Re: [R] Questions on formula in princomp

2006-04-14 Thread Gabor Grothendieck
Just use model.frame to examine what is passed: ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) lir - data.frame(log(ir)) names(lir) - c(a,b,c,d) lir[1,1] - NA mf - model.frame(~., lir,na.action=na.omit) head(mf) ab c d 2 1.589235 1.098612 0.3364722

Re: [R] Adding values to top of bars in barchart

2006-04-14 Thread Eric Archer
Deepayan, Thanks much! That works perfectly! Cheers, eric Deepayan Sarkar wrote: On 4/14/06, Eric Archer [EMAIL PROTECTED] wrote: Given the following data frame (freq.sp), str(freq.sp) `data.frame': 42 obs. of 4 variables: $ behav : Factor w/ 6 levels approach,bowride,..: 1 1

Re: [R] Random specification in LMER

2006-04-14 Thread Spencer Graves
(see inline) Arnaud Ghilain wrote: Hello, Can anybody help me understand the difference between the three different codes in specifying the slope in the random part of a mixed model using LMER? Here are the codes: (age | id) (1 + age | id) SG: These to are the same: For each

Re: [R] Questions on formula in princomp

2006-04-14 Thread Sasha Pustota
Ok, that was just my wishful thinking. Is there a way to plot repeated labels that identify groups, e.g. factor(c(rep(s,50),rep(c,50),rep(v,50))) instead of 1--150 row indices, using something like biplot(princomp(lir)) ? Gabor Grothendieck [EMAIL PROTECTED] wrote: Just use model.frame to

[R] Calling variables dynamically

2006-04-14 Thread kewley
I've looked in the online documentation for this, but have been unable to find an answer. I can name variables dynamically, but I cannot call them dynamically. Either a direct answer or a reference to an online resource that has the answer would be great. I'm trying to write a script that imports

Re: [R] Calling variables dynamically [Broadcast]

2006-04-14 Thread Liaw, Andy
1. The FAQ entry advise you to use a list, instead of using assign() in a loop. Have you considered that? 2. See ?get. Andy From: [EMAIL PROTECTED] I've looked in the online documentation for this, but have been unable to find an answer. I can name variables dynamically, but I cannot

[R] writing a glm link function

2006-04-14 Thread Jessi Brown
Hello all. I could really use some help in writing a new glm link function in order to run an analysis of daily nest survival rates. I've struggled with this for weeks now, but I'm afraid I can't figure out even how to get started (fairly new at R, complete beginner in writing functions in R!).

Re: [R] Questions on formula in princomp

2006-04-14 Thread Berton Gunter
One of the components of the returned princomp() objects can be $scores, the matrix of scores. You can plot these as usual using any characters you like via the 'pch' parameter of plot: e.g. ## groups is a factor giving the groups for each data value.Assuming three groups

Re: [R] Questions on formula in princomp

2006-04-14 Thread Sasha Pustota
Berton Gunter [EMAIL PROTECTED] wrote: plot(myscores[,1:2],pch=c('s','c','v')[groups]) Thanks, this works. How to understand the result of the expression c(1,2,'3)[groups] [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 where groups - factor(c(rep(X,5), rep(Y,5), rep(Z,5))) ? Sorry if it's

Re: [R] Questions on formula in princomp

2006-04-14 Thread Sasha Pustota
Sasha Pustota [EMAIL PROTECTED] wrote: Berton Gunter [EMAIL PROTECTED] wrote: plot(myscores[,1:2],pch=c('s','c','v')[groups]) Thanks, this works. How to understand the result of the expression c(1,2,'3)[groups] [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 where groups -

Re: [R] Questions on formula in princomp

2006-04-14 Thread jim holtman
does this explain it? groups - factor(c(rep(Z,5),rep(X,5),rep(Y,5))) groups [1] Z Z Z Z Z X X X X X Y Y Y Y Y Levels: X Y Z as.integer(groups) [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 c(1,2,3)[groups] [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 On 4/14/06, Sasha Pustota [EMAIL PROTECTED] wrote: Sasha

Re: [R] Questions on formula in princomp

2006-04-14 Thread Sasha Pustota
jim holtman [EMAIL PROTECTED] wrote: does this explain it? groups - factor(c(rep(Z,5),rep(X,5),rep(Y,5))) groups [1] Z Z Z Z Z X X X X X Y Y Y Y Y Levels: X Y Z as.integer(groups) [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 c(1,2,3)[groups] [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2 I did

[R] matching identical row names

2006-04-14 Thread Srinivas Iyyer
dear group, i have a sample matrix name v1 v2 v3 v4 cat 1011 12 15 dog 3 12 10 14 cat 9 12 12 15 cat 5 12 10 11 dog 12113 123 31 ... since cat is repeated 3 times, I want a mean value for it. Like wise for every element of the name