Re: [R] how to generate object name automatically?

2005-05-13 Thread Stefano Calza
What about assign? assign(raw.labs[1],123) maybe you're thinking about something like this (raw.values = vector of values) for(i in 1:length(raw.labs)) assign(raw.labs[i],raw.values[i]) Not elegant but works Stefano On Fri, May 13, 2005 at 11:24:24PM +0800, Xiao Shi wrote: Hi everybody,

[R] weird behaviour of summary.default

2006-06-12 Thread Stefano Calza
Hi all. I may missing something here, but if I do summary.default(1:), I get: Min. 1st Qu. MedianMean 3rd Qu.Max. 12500500050007500 but if I do summary.default(1:10001) I get: Min. 1st Qu. MedianMean 3rd Qu.Max. 1250150

Re: [R] Latex-Style Characters in R

2006-06-15 Thread Stefano Calza
Try ?plotmath Stefano On Thu, Jun 15, 2006 at 10:18:25AM +0200, Lorenzo Isella wrote: Dear All, I am starting to use R excellent graphical facilities to produce good-looking plots. However, I do not know yet how for use pedices/apices (e.g. when you write cm^3) and Greek letters (e.g. \sigma) wh

Re: [R] Assignemt problem ,,,,,,,,,,,,,,,

2006-06-16 Thread Stefano Calza
Hi, your matix has 5 rows and 6 columns. So, either you do ind <- 1:5 res[,1] <- ind or dim(res) <- c(6,5) HIH, Stefano On Fri, Jun 16, 2006 at 09:13:54AM -, anil kumar rohilla wrote: ? Hello list, i have a very simple question about matrix assignment. i did like this. res<-1:30

Re: [R] Survival

2006-06-27 Thread Stefano Calza
try using summary(os, censored=T) Stef On Tue, Jun 27, 2006 at 01:57:38PM +0200, Michela Ballardini wrote: Dear all, I write to know if it possible to know the number of censor subject in function of time. I run: os<-survfit(Surv(datios$time,datios$status)) summary(os) but it give me only the

Re: [R] removing for loop

2006-07-04 Thread Stefano Calza
I guess outer(b,b,"-") gives what you want HIH, Stefano On Tue, Jul 04, 2006 at 11:43:19AM +0200, [EMAIL PROTECTED] wrote: Dear Rusers, Trying to reduce my for loops addiction, could somebody tell me if there are ways to simplify (and perhaps accelerate ?) the following line for (i in 1:N) for

Re: [R] terms.inner

2006-09-05 Thread Stefano Calza
On Tue, Sep 05, 2006 at 08:24:54AM -0500, Terry Therneau wrote: ... ... > plot.gam Error: object "plot.gam" not found if I do library(gam) plot.gam it prints the function Ok, I know this function has to exist. I even remember that there is some sort of multi-colon secret handshake that

Re: [R] Running glm in batch and exporting results (AIC) to HTML

2005-09-20 Thread Stefano Calza
see ?html in Hmisc package HIH Ste On Tue, Sep 20, 2005 at 02:56:17PM +0200, [EMAIL PROTECTED] wrote: see ?write.table hih __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http:/

Re: [R] Can anyone please tell me how to strip the white spaces from acharacter vector?

2005-10-25 Thread Stefano Calza
What about xx <- c("AIR ", "ABCB ", "ABXA ", "ACMR ", "ADCT ", "ADEX "," AAA") xx=gsub("[[:blank:]]","",xx) Stefano On Tue, Oct 25, 2005 at 03:14:39PM +0200, Dimitris Rizopoulos wrote: one way is to use strsplit(), i.e., xx <- c("AIR ", "ABCB ", "ABXA ", "ACMR ", "ADCT ", "ADEX ") Best, Dimi

Re: [R] SPSS and R ? do they like each other?

2005-11-21 Thread Stefano Calza
Hi, from SPSS you can save in export format and then use read.spss in R. But you don't retain the labelling (AFAIK). Nevertheless, let me ask you what kind of table spss gives you that R can't? Ciao, Stefano On Mon, Nov 21, 2005 at 01:33:39PM +0100, Thomas Schönhoff wrote: Hello Micael, 2005

Re: [R] putting stuff into bins...

2006-09-26 Thread Stefano Calza
I don't know about such a function, but tapply(data,cut(data,breaks),what to do) should give you what you need. HIH Ciao, Stefano On Tue, Sep 26, 2006 at 12:44:35PM +0100, Federico Calboli wrote: Hi All, I have a vector of data, a vector of bin breakpoints and I want to put my data in the b

Re: [R] Block comments in R?

2006-10-06 Thread Stefano Calza
And of course in emacs you can select the region to comment then hit Ctrl-x r t and type #: all the lines in that region will have a # at the beginnig To uncomment Ctrl-x r d Stefano On Fri, Oct 06, 2006 at 07:05:52PM -0400, Jim Lemon wrote: And of course for NEdit, all one needs to do is sel

Re: [R] Block comments in R?

2006-10-06 Thread Stefano Calza
u should for "full line comments") Martin -- Stefano Calza, PhD Researcher - Biostatistician *Sezione di Statistica Medica e Biometria Dipartimento di Scienze Biomediche e Biotecnologie Università degli Studi di Brescia - Italy Viale Europa, 11 25123 Brescia email: [EMAIL PROT

Re: [R] new R-user needs help

2006-10-18 Thread Stefano Calza
Hi, you can use aggregate. aggregate(data[,c(3:8)],list(data$name),mean) should give you what you want. Ciao, Stefano On Wed, Oct 18, 2006 at 11:10:04AM +0200, [EMAIL PROTECTED] wrote: Dear all, I have a dataset Exp name id x1 x2 x3 x4 x5 1 a1 23 24 23 22 30 1 b2 25 26 27 23

Re: [R] new R-user needs help

2006-10-18 Thread Stefano Calza
Hi, use aggregate aggregate(dataset[,-c(1:3)],list(dataset$name),mean) should give you what you need Ciao, Sfetano On Wed, Oct 18, 2006 at 11:10:04AM +0200, [EMAIL PROTECTED] wrote: Dear all, I have a dataset Exp name id x1 x2 x3 x4 x5 1 a1 23 24 23 22 30 1 b2 25 26 27 23 2

Re: [R] write data to pdf

2006-10-19 Thread Stefano Calza
Give a look at Sweave library(tools) ?Sweave or RNews 2002 vol 2 number 3 and 2003 vol 3 number 2 Stefano On Thu, Oct 19, 2006 at 04:09:56PM +0200, Franco Mendolia wrote: Hello! Is there a possibility in R to save data in pdf-format? I do not want to save a plot but some lines of simple text.

Re: [R] Recipe: Print a Color Sampler

2006-10-22 Thread Stefano Calza
Thanks, might be very useful. I attached a slightly modified version that uses identify (whith an argument to choose if use it), to return the name of the colors on the panel. Left-click on the choosen colors, and right click to end. Stefano On Sun, Oct 22, 2006 at 12:51:19PM +0100, Ana Nelso

Re: [R] nested if/else very slow, more efficient ways?

2006-10-24 Thread Stefano Calza
If I get it right (data are not well aligned!) these are values in Class column. Right? Than Class = as.numeric(factor(Class)) should work Stefano On Tue, Oct 24, 2006 at 08:20:08AM -0500, Kim Milferstedt wrote: Hi Alex, find below a sample of the input and the desired output of my data. 5a

Re: [R] ordering a data frame to same order as a chr vector

2006-01-23 Thread Stefano Calza
Hi, if I got it right I'd suggest to use match (which would allow you to use also character vectors) So tdf[match(tv,tdf[,1]),] will give you tdf in the same order as tv HIH Ste On Mon, Jan 23, 2006 at 04:09:58PM +, Ken Termiso wrote: Let me clarify the problem a bit further: tv <- 1:1

Re: [R] What's wrong with Rcmdr?

2006-01-26 Thread Stefano Calza
Try using Commander() but, obviously, the first time. HIH, Ste On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: Hi all, I successfully installed Rcmdr. And I type "library(Rcmdr)", nothing happened; or if I select menu item "load package" and select "Rcmdr", still nothing happened...

Re: [R] What's wrong with Rcmdr?

2006-01-26 Thread Stefano Calza
uldn't find function "Commander" On 1/26/06, Stefano Calza <[EMAIL PROTECTED]> wrote: > > Try using > > Commander() > > but, obviously, the first time. > > HIH, > Ste > > On Thu, Jan 26, 2006 at 01:11:23AM -0800, Michael wrote: > Hi all, > &

Re: [R] hist() Frequancy values

2007-07-18 Thread Stefano Calza
Try xx = hist(yy,plot=FALSE) ## plot=FALSE if you don't want to plot it and then xx$counts HIH Stefano On Wed, Jul 18, 2007 at 12:34:42PM +0200, Manuele Pesenti wrote: I have seen that the hist() function plots an histogram of the frequency but I cannot find the value of the object hist tha

Re: [R] presence/absence matrix

2007-07-20 Thread Stefano Calza
What about table(sample,species) Stefano On Fri, Jul 20, 2007 at 04:16:39PM +0200, [EMAIL PROTECTED] wrote: I have a table such that: sample # species 1a 1b 2a 2c 3b and i would like to build a matrix with species names (i.e. a b and c) as field names and sampl

Re: [R] substituting values

2006-03-09 Thread Stefano Calza
On Thu, Mar 09, 2006 at 08:44:27AM -0500, Chuck Cleland wrote: X <- matrix(c( 1, 2, 3, 4, "x", "x", 2, 2, 2, 2, 2, 2, 2, "x", 2), ncol=5, byrow=TRUE) Why not: X[X=="x"] <- NA mode(X) <- "numeric" ## to get a numeric matrix Btw if you got X wi

Re: [R] Linux editor like WinEdt?

2006-03-10 Thread Stefano Calza
What about Tinn-R? www.sciviews.org (but the "correct" link is the R site) It's free and with a lot of interesting features. Afaik, no latex and for windows only. I'll spend some hours to get used to *emacs though...it'll pay off!! My 2 cents Stefano On Fri, Mar 10, 2006 at 06:17:18PM +0100,

Re: [R] mean(NA)

2006-05-25 Thread Stefano Calza
I do get the same under R 2.3.0, Linuex (Debian 3.0) Stefano On Thu, May 25, 2006 at 07:39:17AM -0400, Gabor Grothendieck wrote: Running under Windows XP I get the same result on "Version 2.3.0 Patched (2006-05-03 r37977)" but get NA on "R version 2.2.1, 2005-12-20" so it must relate to some ch

Re: [R] Row-wise two sample T-test on subsets of a matrix

2007-03-01 Thread Stefano Calza
I'd suggest to use the function mt.teststat in the package multtest or rowttests in the package genefilter. Both can be found athe the bioconductor webpage (www.bioconductor.org) Stef On Thu, Mar 01, 2007 at 12:48:29PM -0600, Ranjan Maitra wrote: Here's one suggestion: convert the matrix i

Re: [R] hclust error

2004-07-19 Thread Stefano Calza
Try hc <- hclust(t(x),"average") HIH, Ste On Mon, Jul 19, 2004 at 10:49:24AM -0400, Herman, David (NIH/NIMH) wrote: > Hello, > I'm trying to do a cluster analysis on a large data set. I > tried it out with a smaller one first, but I got this error: > > > hc<-hclust(dist(x),"ave")

Re: [R] Testing for normality of residuals in a regression model

2004-10-15 Thread Stefano Calza
What about shapiro.test(resid(fit.object)) Stefano On Fri, Oct 15, 2004 at 02:44:18PM +0200, Federico Gherardini wrote: > Hi all, > > Is it possible to have a test value for assessing the normality of > residuals from a linear regression model, instead of simply relying on > qqplots? > I've tr

Re: [R] displaying sample size in boxplots

2004-09-29 Thread Stefano Calza
On Wed, Sep 29, 2004 at 08:08:19AM -0500, Marc Schwartz wrote: > On Wed, 2004-09-29 at 07:46, Patrick Drechsler wrote: > > Hi, > > > > I was wondering if there is a ready made function or parameter > > for indicating the sample size in boxplots? > > > > Here's what I came up with so far: > > > >

[R] OT: apt-get and R in Debian

2003-11-27 Thread Stefano Calza
Hi everybody, Sorry for the OffTopic, but I always have a problem using apt-get to update my debian siystem and R. Anytime it updates the packages (right now I installed a self-compiled version of 1.8.1), even if they are exactly the same. Anybody can help me? TIA, Stefano __

Re: [R] OT: apt-get and R in Debian

2003-11-27 Thread Stefano Calza
gt; about R installation? Yes, it would be a great idea! Thanks, Ste > > -- > Douglas Bates[EMAIL PROTECTED] > Statistics Department608/262-2598 > University of Wisconsin - Madison http://www.stat.wisc.edu/~bates/ -- Stefano

Re: [R] Maps in R

2003-01-09 Thread Stefano Calza
gt; > http://matheron.uv.es/~virgil > > TLF: 00 34 96 354 43 62 - FAX: 00 34 96 354 47 35 > > __ > [EMAIL PROTECTED] mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help Stefano Calza Sezione di Statistica Me

[R] GLMMGibbs crashes R

2003-02-12 Thread Stefano Calza
Hi everybody. I'm trying to use the GLMMGibbs package (R 1.6.2, Linux/Debian 3.0) with the data scottish.lip.cancer, as described in the paper by J.Miles and D. Clayton. The problem is that the code at pag 18 crasches R: ***sparse_rd***too few elements (column 32) /n Process R exited abnormall

Re: [R] how to sort columns in a matrix?

2003-07-09 Thread Stefano Calza
On Wed, Jul 09, 2003 at 05:39:31PM +0200, David Andel wrote: Hi, if you want to sort in alphabical order the columns of the matrix you colud do this aaa <- aaa[,sort(colnames(aaa))] Is it what you want? HIH, Stefano > Hi > > I am struggling in finding a way to sort columns in a matrix. Can

Re: [R] how to sort columns in a matrix?

2003-07-09 Thread Stefano Calza
s. spencer graves > > Stefano Calza wrote: > >On Wed, Jul 09, 2003 at 05:39:31PM +0200, David Andel wrote: > > > >Hi, > > > >if you want to sort in alphabical order the columns of the matrix you > >colud do this > > > >aaa <- aaa[,

[R] compiling & installing R devel version on Debian

2005-04-14 Thread Stefano Calza
Hi all. I'm compiling the devel version of R on Debian GNU/Linux, and installing it into /usr/local tree (instead of default /usr). So: ./configure --prefix=/usr/local/ make make install Everything works fine, but when I start R I get the following error messages (traslated from italian, sorry

Re: [R] compiling & installing R devel version on Debian - SOLVED

2005-04-14 Thread Stefano Calza
Thanks to Prof. Ripley I solved it. Actually it was my (stupid) fault. In .Renviron I actually set R_LIBS Thanks again Stefano On Thu, Apr 14, 2005 at 11:07:00AM +0100, Prof Brian Ripley wrote: On Thu, 14 Apr 2005, Stefano Calza wrote: >Hi all. > >I'm compiling the devel v

Re: [R] Julian dates

2004-01-28 Thread Stefano Calza
I guess there's a "bug" in chron as you cannot pass the argument cut.off to year.expand. Adding ,... in chron arguments and along the code ,... to convert.dates does the trick. HIH, Stefano On Wed, Jan 28, 2004 at 11:50:11AM +0100, Massimiliano Tripoli wrote: > Hi all, > I have problems with y

Re: [R] Doubt about pattern

2004-01-30 Thread Stefano Calza
what about dir(pattern="\\.sens+$") HIH Ste On Thu, Jan 29, 2004 at 11:33:25AM -0300, Marcelo Luiz de Laia wrote: > Hi All, > > I have a very simple problem. I have several files in a same directory. I would like > to send for an object only the files that finish in ".sens.". I execute the com

[R] Re: Julian dates

2004-01-30 Thread Stefano Calza
origin is a different matter than cut.off. That happens as in chron there's a call to convert.dates and here to expand.year. If you look into the code you see that this function convert 2 digits years (e.g. 30 to 1930). The cut of is set to 30. So 27 -> 20027, 31 -> 1931. origin is just needed

Re: [R] Doubt about pattern

2004-01-30 Thread Stefano Calza
On Fri, Jan 30, 2004 at 12:46:44PM +0100, Peter J. Acklam wrote: ...cut... > > Stefano Calza <[EMAIL PROTECTED]> wrote: > > > > dir(pattern="\\.sens+$") > > That will find files ending with ".sens", ".senss", ".sensss", >

Re: [R] proportions

2004-02-11 Thread Stefano Calza
Or look at CrossTable in package gregmisc (which actually uses prop.table) to get something like proc freq in SAS. HIH, Stefano On Wed, Feb 11, 2004 at 01:11:21PM -0600, Marc Schwartz wrote: > On Wed, 2004-02-11 at 08:49, Mauricio Cardeal wrote: > > Hi all: > > > > Please be patient with my sil

[R] problem with update.packages()

2004-03-29 Thread Stefano Calza
Hi. I'm experiencing a problem with updating packages on R 1.8.1 (2003-11-21) on Debian testing. I get the following message when updating for example Design: ... ... /usr/bin/ld: cannot find -lg2c-pic ... But I sould have it. I never had problem before $gcc -v Reading specs from /usr/lib/gcc

[R] problem with update.packages() - SOLVED

2004-03-29 Thread Stefano Calza
Hi, problem solved passing to R 1.9.0 (in the Debian unstable branch). Stefano __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Sweave and graphic output locations

2004-03-30 Thread Stefano Calza
Hi, you can use \SweaveOpts{prefix.string=foo/bar} So you'll have your graphs put into directory foo and named bar-* HIH, Stefano On Tue, Mar 30, 2004 at 12:31:36PM -0500, [EMAIL PROTECTED] wrote: > > Hello, > > I'm using R1.8.1 on windows 2000 and version 1.8.1 of the tools package. > > I am

[R] extractAIC.survreg problem with df

2004-04-21 Thread Stefano Calza
Hi everybody. I'm having problems with the extractAIC.survreg function and the edf I get weird results which I think are due to the fact that the function defines edf as (from the stats package in 1.9.0 source code) ... ... n <- length(fit$residuals) edf <- n-fit$df.residual ... But in a survr