Re: [R] Factor levels.

2007-10-02 Thread Ted Harding
On 03-Oct-07 04:57:33, Rolf Turner wrote: > I have factors with levels ``Unit", "Achieved", and "Scholarship"; I > wish to replace these with > "U", "A", and "S". > > So I do > > fff <- factor(fff,labels=c("U","A","S")) > > This works as long as all of the levels are actually present in

Re: [R] How to modify function for list

2007-10-02 Thread Chung-hong Chan
Thanks for your answer. But I have a strange question that I don't know how to explain and I really don't know how to spot the problematic part. Suppose I have a long list of age, gender and bmi from a data.frame called msltdata. > age <- msltdata$age > gender <- msltdata$data > bmi <-msltdata$bm

[R] How to avoid overfitting in gam(mgcv)

2007-10-02 Thread 神野有生
Dear listers, I'm using gam(from mgcv) for semi-parametric regression on small and noisy datasets(10 to 200 observations), and facing a problem of overfitting. According to the book(Simon N. Wood / Generalized Additive Models: An Introduction with R), it is suggested to avoid overfitting by infla

Re: [R] Factor levels.

2007-10-02 Thread Peter Dalgaard
Rolf Turner wrote: > I have factors with levels ``Unit", "Achieved", and "Scholarship"; I > wish to replace these with > "U", "A", and "S". > > So I do > > fff <- factor(fff,labels=c("U","A","S")) > > This works as long as all of the levels are actually present in the > factor. But if ``

Re: [R] Factor levels.

2007-10-02 Thread Christos Hatzis
Would levels(fff) <- c("A","S","U") not work? Can you send an example? -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner > Sent: Wednesday, October 03, 2007 12:58 AM > To: r-help list > Subject: [R] Factor levels. > > > I

Re: [R] How to modify function for list

2007-10-02 Thread Christos Hatzis
Instead of > bmisds(age,gender,bmi) Try the vectorized version > mapply(bmisds, age, gender, bmi) See ?mapply -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Chung-hong Chan > Sent: Wednesday, October 03, 2007 12:31 AM > To: [EMA

[R] Factor levels.

2007-10-02 Thread Rolf Turner
I have factors with levels ``Unit", "Achieved", and "Scholarship"; I wish to replace these with "U", "A", and "S". So I do fff <- factor(fff,labels=c("U","A","S")) This works as long as all of the levels are actually present in the factor. But if ``Scholarship'' is absent (as if of

[R] How to modify function for list

2007-10-02 Thread Chung-hong Chan
Dear R Gurus, I have a function which calculate the BMI standard deviation score based on the age and gender specific L, M, S value. I have written a function like this bmisds <- function (age, gender, bmi){ if (age ==1 & gender ==1) { bmif <- c(-1.013,16.133,0.07656) } else if

Re: [R] R routines vs. MATLAB/SPSS Routines

2007-10-02 Thread Katharine Mullen
I would stress the advantages of the free and open source nature of R over the proprietary programs you mention. Because R is free (as in beer), your student will have access to it even when they are free of the university that I presume buys a MATLAB/SPSS license for them. And because R is open so

Re: [R] "unique" rows in data frame

2007-10-02 Thread Gabor Grothendieck
Try this: > DF[!duplicated(DF$x1), ] x1 x2 1 A 1 2 B 2 > # or > subset(DF, !duplicated(x1)) x1 x2 1 A 1 2 B 2 On 10/2/07, Dieter Best <[EMAIL PROTECTED]> wrote: > Hello there, > > I have a data frame a small version of which could look like the following: > >x1 x2 > 1 A 1 > 2

Re: [R] Design package: plot summary

2007-10-02 Thread Frank E Harrell Jr
Cary Dehing-Oberije wrote: > Hi everybody, > > I am a new user of R, design package. > I am trying to plot the estimated hazard ratio's of my cox regression > model with the confidence intervals. But I keep getting the > message:Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : >

Re: [R] Calculating proportions from a data frame rather than a table

2007-10-02 Thread Farrel Buchinsky
How do you create a table from a data frame? I tried as.table( name.of.data.frame) but it bombed out. I will include the exact error message in my next posting. If I recall correctly, it said that the data.frame could not be coerced to a table. On 10/2/07, John Kane <[EMAIL PROTECTED]> wrote: > >

[R] Design package: plot summary

2007-10-02 Thread Cary Dehing-Oberije
Hi everybody, I am a new user of R, design package. I am trying to plot the estimated hazard ratio's of my cox regression model with the confidence intervals. But I keep getting the message:Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to facto

[R] GARCH simulations

2007-10-02 Thread twickra
Hey, Is there any way to simulate a GARCH(1,1) data set? Thanks Tharanga __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commente

Re: [R] Printing to jpeg (dev.print)

2007-10-02 Thread Prof Brian Ripley
On Tue, 2 Oct 2007, Marcin Kozak wrote: > This may be an easy question, but let me ask it. When writing a plot > to a jpeg file: You do realize that is not what this does: it copies a plot from a screen device to a jpeg device? >> plot(runif(30)) >> dev.print(file="test.jpeg", device=jpeg, widt

[R] R routines vs. MATLAB/SPSS Routines

2007-10-02 Thread Matthew Dubins
Hi all, I've become quite enamored of R lately, and have decided to try to teach some of its basics (reading in data, manipulation and classical stats analyses) to my fellow grad students at the University of Toronto. I sent out a mass email and have already received some positive responses.

Re: [R] Calculating proportions from a data frame rather than a table

2007-10-02 Thread John Kane
What am I missing here? Cannot you just create the table from the data.frame and apply prop.table()to it? --- Farrel Buchinsky <[EMAIL PROTECTED]> wrote: > When one has raw data it is easy to create a table > of one variable against > another and then calculate proportions > For example > a.nice

[R] Protect your brand online

2007-10-02 Thread London4Jobs
This is a text part of the message. It is shown for the users of old-style e-mail clients __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email

Re: [R] Trouble obtaining results from a loop

2007-10-02 Thread jim holtman
I think this gives you what you are looking for: > P.genotype.sample [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]262236155 5 [2,]232833555 8 [3,]132888558 8

Re: [R] "unique" rows in data frame

2007-10-02 Thread Dieter Best
Hi guys, thanks for all your help. I didn't know about aggregate yet. John Kane <[EMAIL PROTECTED]> wrote: ?aggregate x <- data.frame(a= as.factor(c("A", "B" , "B" ,"C" ,"B", "A", "D")), b = c(3, 2, 1, 1, 2, 3, 7)) aggregate(x[,2], list(x[,1]), mean) --- Dieter Best wrote: > Hello

Re: [R] plot question

2007-10-02 Thread hadley wickham
The last example does connect the points of average intensity, doesn't it? Hadley On 10/2/07, Tiandao Li <[EMAIL PROTECTED]> wrote: > > Thanks for your help, Hadley. I want to treat concentration as factor, and > the 2nd and 3rd part of codes are what I wanted. However, how to draw the > lines to

Re: [R] "continuous" boxplot?

2007-10-02 Thread Deepayan Sarkar
On 10/2/07, Bert Gunter <[EMAIL PROTECTED]> wrote: > > > Folks: > > I found the references in the previous replies to this vexing data > visualization issue to be quite interesting and useful. I think it fair to > say that there is no single "best" way to do this -- it all depends on what > you nee

Re: [R] plot question

2007-10-02 Thread Tiandao Li
Thanks for your help, Hadley. I want to treat concentration as factor, and the 2nd and 3rd part of codes are what I wanted. However, how to draw the lines to connect the points of average intensity of each gene at different concentrations? On Tue, 2 Oct 2007, hadley wickham wrote: On 10/2/07,

[R] Trouble obtaining results from a loop

2007-10-02 Thread Luke Neraas
#Hello, #I have a question about obtaining results from a loop I have written. #Below is a sample of individual genotypes from a genetic question I am working on called "P.genotype.sample ". P.genotype.sample<-matrix(10,10,10) P.genotype.sample[,1]<-c(2,2,1,5,1,1,5,6,1,3) P.genotype.sample[,2]<-c(

Re: [R] plot question

2007-10-02 Thread hadley wickham
On 10/2/07, Tiandao Li <[EMAIL PROTECTED]> wrote: > Hello, > > I have a question about how to plot a series of data. The folloqing is my > data matrix of n > > n > 25p5p 2.5p 0.5p > 16B-E06.g 45379 4383 5123 45 > 16B-E06.g 45138 4028 6249 52 > 16B-E06.g 48457 4267 5470

Re: [R] Strange names when creating a data.frame: Difference between <- and =

2007-10-02 Thread Vladimir Eremeev
John Kane-2 wrote: > > This is just a curiosity question. Why do the two > different syntaxes for df1 and df2 give such different > results in the names(dfx)? > > Thanks > > > df1 <- data.frame(nas = c("A", "B" , "B" ,"C" ,"B", > "A", "D"),nums = c(3,2,1, 1, 2,3, 7)) > >

Re: [R] plot question

2007-10-02 Thread Tiandao Li
Hello Eric, I got it right this time. You are right, regression line is way too messy. For each gene, plot the lines connecting the points of the average intensity at different concentrations, and write gene ID at the end of line. I am new to the R graphics, any help is appreciated. On Tue, 2

Re: [R] "unique" rows in data frame

2007-10-02 Thread John Kane
?aggregate x <- data.frame(a= as.factor(c("A", "B" , "B" ,"C" ,"B", "A", "D")), b = c(3,2,1, 1, 2,3, 7)) aggregate(x[,2], list(x[,1]), mean) --- Dieter Best <[EMAIL PROTECTED]> wrote: > Hello there, > > I have a data frame a small version of which could > look like th

Re: [R] Strange names when creating a data.frame: Difference between <- and =

2007-10-02 Thread Prof Brian Ripley
On Tue, 2 Oct 2007, John Kane wrote: > This is just a curiosity question. Why do the two > different syntaxes for df1 and df2 give such different > results in the names(dfx)? Because only in the second case did you specify the names in the call. When you do nas <- c("A" ...) the argument has no

Re: [R] "continuous" boxplot?

2007-10-02 Thread roger koenker
If what is desired is a plot of conditional quantiles of y given x, then loess plots of y on x binned on y is really not a good strategy. You might try something like this: library(quantreg) x <- (0:1000/1000)*2*pi y <- sin(2*x) + rnorm(1001)/5 plot(x,y,pch =".") plot(rqss(y ~ qss(x)),col="re

Re: [R] Strange names when creating a data.frame: Difference between <- and =

2007-10-02 Thread jim holtman
your two dataframe defintions are different. In the case of df1, you have 'names' the elements, and in the case of df2,you have done an assignment to 'nam' and 'num' (look in the workspace and you will see the object. Since you haven't names the elements in df2, is tries to constuct a name from t

Re: [R] "continuous" boxplot?

2007-10-02 Thread hadley wickham
A couple of other nice references for dealing with many points in a scatterplot are: D. B. Carr, R. J. Littlefield, W. L. Nicholson, and J. S. Littlefield. Scatterplot matrix techniques for large n. Journal of the American Statistical Association, 82(398):424–436, 1987. W. S. Cleveland and R. McG

Re: [R] "unique" rows in data frame

2007-10-02 Thread jim holtman
Here is one way to get the means: > x x1 x2 1 A 1 2 B 2 3 B 3 > aggregate(x$x2, list(x$x1),mean) Group.1 x 1 A 1.0 2 B 2.5 > On 10/2/07, Dieter Best <[EMAIL PROTECTED]> wrote: > Hello there, > > I have a data frame a small version of which could look like the following:

Re: [R] plot question

2007-10-02 Thread Eric Thompson
But you did not use the command I suggested: you replaced x with colnames(n), which is a vector of characters. Characters such as "25p" has little meaning for plotting: > as.numeric("25p") [1] NA So you've tried to plot a bunch of NA's, which is why it doesn't know what limits to use for xlim. T

Re: [R] Problem loading a txt file as a data.frame

2007-10-02 Thread Charles C. Berry
On Tue, 2 Oct 2007, Ettinger, Nicholas wrote: > Hello all, > > I know that this is a terribly banal question but I cannot seem to solve > it. > > I am trying to load in data from a tab-delimited text file. Some > columns are mixed text-numbers and other columns are strictly numbers. > Some cells

Re: [R] plot question

2007-10-02 Thread Tiandao Li
However, I got the following msg. > matplot(colnames(n), t(n), pch = 1, axes = FALSE) Error in plot.window(xlim, ylim, log, asp, ...) : need finite 'xlim' values In addition: Warning messages: 1: NAs introduced by coercion in: as.double.default(x) 2: no non-missing arguments to min; retu

[R] Adehabitat package question - trying to generate animal home ranges

2007-10-02 Thread Peter H Singleton
Hello, I'm new to R and am trying to use the adehabitat package for home range and habitat selection analysis for some animal radiotelemetry data sets I have, but I can't get the home range functions (mcp & kernelUD) to work with my data. I think that my problem is that I don't properly understan

[R] Strange names when creating a data.frame: Difference between <- and =

2007-10-02 Thread John Kane
This is just a curiosity question. Why do the two different syntaxes for df1 and df2 give such different results in the names(dfx)? Thanks df1 <- data.frame(nas = c("A", "B" , "B" ,"C" ,"B", "A", "D"),nums = c(3,2,1, 1, 2,3, 7)) df2 <- data.frame(nas <- c("A", "B" , "B" ,"C

Re: [R] "continuous" boxplot?

2007-10-02 Thread Bert Gunter
Folks: I found the references in the previous replies to this vexing data visualization issue to be quite interesting and useful. I think it fair to say that there is no single "best" way to do this -- it all depends on what you need to learn , and probably several alternative displays will be n

[R] Problem loading a txt file as a data.frame

2007-10-02 Thread Ettinger, Nicholas
Hello all, I know that this is a terribly banal question but I cannot seem to solve it. I am trying to load in data from a tab-delimited text file. Some columns are mixed text-numbers and other columns are strictly numbers. Some cells are blank. My command is: >MDMT_RPup <- read.table

Re: [R] plot question

2007-10-02 Thread Eric Thompson
Okay. If you want to customize the axis labels, you can suppress the defaults by changing the matplot call to matplot(x, t(n), pch = 1, axes = FALSE) And then adding them how you want: axis(side = 2) axis(side = 3, at = x, lab = colnames(n)) box() On 10/2/07, Tiandao Li <[EMAIL PROTECTED]> wr

Re: [R] plot question

2007-10-02 Thread Tiandao Li
Thanks for your quick reply, Eric. I want plot colnames(n) as string on x-axis. If the regression lines don't fit the data very well, it is OK, the plot is only for quality check. On Tue, 2 Oct 2007, Eric Thompson wrote: If I've correctly interpreted what you want, you first need to get the x

[R] "unique" rows in data frame

2007-10-02 Thread Dieter Best
Hello there, I have a data frame a small version of which could look like the following: x1 x2 1 A 1 2 B 2 3 B 3 Now I need to remove rows which are duplicate in x1, i.e. in the example above I would remove row 3. I have an ugly solution with for and while loops a

[R] Variable selection in R

2007-10-02 Thread Yves Moisan
Disclaimer : Short of having local statistical expertise at hand, I'm using this list because I use R for variable selection in the context of linear multiple regression but the questions I have relate more to basic statistics than to R per se. Please redirect me to another appropriate list if su

Re: [R] "continuous" boxplot?

2007-10-02 Thread Jim Porzak
Karin, I like to use bagplots in these cases where there are a lot of cases and scatter plots become one big smudge. See http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/bagplot/bagplot.pdf And some further examples on slides 36 - 39 of http://www.porzak.com/JimArchive/JimPorzak_CIwithR_

Re: [R] phyper returns negative results

2007-10-02 Thread Prof Brian Ripley
On Tue, 2 Oct 2007, Bastian Angermann wrote: > Dear R-users, > > In R 2.5.1 on Windows XP, SP2 the call to > phyper(0,0,74,3,lower.tail=FALSE) returns -4.195862e-17. This does not > happen with R2.5.1 on Linux, 0 is returned. Is this a bug (and should be > reported as such), since phyper should

Re: [R] how to plot a graph with different pch

2007-10-02 Thread Greg Snow
I don't think your code is doing what you think it is doing. Try something like: with(mtcars, plot(wt, mpg, xlab= "Weight(lbs/1000)", ylab="Miles per Gallon", col= c('','','','blue','','red','','purple')[cyl], pch= c(0,0,0,3,0,17,0,19)[cyl])) legend(4,30,c("4 cylinder","6 cylinder"

Re: [R] "continuous" boxplot?

2007-10-02 Thread Greg Snow
Here are a couple of things that might help: Look at the hexbin package (I think it is on bioconductor rather than cran) Look at the quantreg package (for estimating the quantiles to plot) Look at the running and wapply functions in the gtools package for another option to estimate the quantiles

Re: [R] how to create this graph?

2007-10-02 Thread Greg Snow
You could create this graph using barplot (give a matrix with the input), then use the text and possibly lines or segments functions to add the text and any additional lines needed. However, this graph is not clear to me, the box with 41 in it looks bigger than the box with 59, are those supposed

Re: [R] plot question

2007-10-02 Thread Eric Thompson
If I've correctly interpreted what you want, you first need to get the x values: x <- colnames(n) x <- as.numeric(substr(x, 1, nchar(x) - 1)) Then it seems fairly easy to use matplot to get the values with different colors for each concentration dim(x) <- c(length(x), 1) matplot(x, t(n), pch = 1

Re: [R] Plot for two Series

2007-10-02 Thread Gabor Grothendieck
Here is an example: ts.plot(ts(1:10, start = 2000), ts(2:8, start = 2005)) On 10/2/07, amna khan <[EMAIL PROTECTED]> wrote: > Sir the data used in function ts.plot() is of the form > > > Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov > 1974 2134 1863 1877 1877 1492 1249 1280 113

Re: [R] permutations of a binary matrix with fixed margins

2007-10-02 Thread Charles C. Berry
On Tue, 2 Oct 2007, Paul Johnson wrote: Jérôme, As a first attempt, how about the function below. It works (or not) by randomly sorting the rows and columns, then searching the table for "squares" with the corners = matrix(c(1,0,0,1),ncol=2) and subtracting them from 1 to give matrix(c(0,1,1,0)

Re: [R] Plot for two Series

2007-10-02 Thread amna khan
Sir the data used in function ts.plot() is of the form Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov 1974 2134 1863 1877 1877 1492 1249 1280 1131 1209 1492 1621 1975 2103 2137 2153 1833 1403 1288 1186 1133 1053 1347 1545 1976 2020 2750 2283 1479 1189 1160 1113 970 999 1208 146

Re: [R] Apparently Conflicting Results with coxph

2007-10-02 Thread Terry Therneau
From my experience, what you are seeing is almost certainly a patient selection effect. (The number 1 reason for puzzling results is incorrect coding of a time-dependent covariate, but you appear to have been quite careful). Assigning the implant as a non-time dependent covariate almost

Re: [R] Apparently Conflicting Results with coxph

2007-10-02 Thread Charles C. Berry
On Tue, 2 Oct 2007, Kevin E. Thorpe wrote: > Kevin E. Thorpe wrote: >> Peter Dalgaard wrote: >>> Kevin E. Thorpe wrote: Dear List: I have a data frame prepared in the couting process style for including a binary time-dependent covariate. The first few rows look like this.

Re: [R] zoo timeserie continuous? complete with NaN

2007-10-02 Thread Gabor Grothendieck
And here is another solution. This one regularizes it by converting to ts and back: > library(chron) > dd <- chron("12/31/2005") + c(12:16, 18:23)/24 > z <- zoo(seq_along(dd), dd) # test series > zz <- aggregate(as.zoo(as.ts(z)), chron, tail, 1) > zz (12/31/05 12:00:00) (12/31/05 13:00:00) (12/31

Re: [R] How to add legend for image()?

2007-10-02 Thread Eric Thompson
Have you tried filled.contour()? It automatically generates a legend. However, I'm not sure what is going on with your x's and y's being sorted random numbers. I assume your actual data are not like this. If you do not have data in an equally spaced grid you may need to create one by some sort of i

Re: [R] fitted values in LMER for the fixed-effects only

2007-10-02 Thread Douglas Bates
On 9/29/07, Dieter Menne <[EMAIL PROTECTED]> wrote: > On 9/28/07, Anouk Simard bio.ulaval.ca> wrote: > > > > I would like to extract the fitted values from a model using LMER but > > > only for the fix portion of the model and not for the fix and random > > > portion (e.g it is the procedure outpm

[R] plot question

2007-10-02 Thread Tiandao Li
Hello, I have a question about how to plot a series of data. The folloqing is my data matrix of n > n 25p5p 2.5p 0.5p 16B-E06.g 45379 4383 5123 45 16B-E06.g 45138 4028 6249 52 16B-E06.g 48457 4267 5470 54 16B-E06.g 47740 4676 6769 48 37B-B02.g 42860 6152 19276

Re: [R] zoo timeserie continuous? complete with NaN

2007-10-02 Thread Gabor Grothendieck
Try this: > library(zoo) > dd <- ISOdate(2005, 12, 31, c(12:16,18:23), tz = "") > z <- zoo(seq_along(dd), dd) # test series > tt <- seq(time(z)[1], time(z)[length(z)], by = "hour") # hours > merge(z, zoo(,tt)) 2005-12-31 12:00:00 2005-12-31 13:00:00 2005-12-31 14:00:00 2005-12-31 15:00:00

[R] zoo timeserie continuous? complete with NaN

2007-10-02 Thread marcg
dear r-list I have a zoo object with 2 objects and time: looks like: 2005-12-31 12:00:00 NA NaN 2005-12-31 13:00:00 NA NaN 2005-12-31 14:00:00 NA NaN 2005-12-31 15:00:00 NA NaN 2005-12-31 16:00:00 NA NaN 2005-12-31 18:00:00 NA NaN

[R] phyper returns negative results

2007-10-02 Thread Bastian Angermann
Dear R-users, In R 2.5.1 on Windows XP, SP2 the call to phyper(0,0,74,3,lower.tail=FALSE) returns -4.195862e-17. This does not happen with R2.5.1 on Linux, 0 is returned. Is this a bug (and should be reported as such), since phyper should not return negative values, or is this considered as one

Re: [R] mcv package gamm function Error in chol(XVX + S)

2007-10-02 Thread Simon Wood
Well, it's certainly a problem detected by gamm, but whether it's a fundamental statistical problem with this model/data combination or something fixable by taking an alternative approach within gamm I can't tell. Would you be able to send me the data used here (I promise not to use it for anyth

[R] Calculating proportions from a data frame rather than a table

2007-10-02 Thread Farrel Buchinsky
When one has raw data it is easy to create a table of one variable against another and then calculate proportions For example a.nice.table<-table(a,b) prop.table(a.nice.table,1) However, I looked at several papers and created a data frame of the aggregate data. That means I acually created a table

Re: [R] lpSolve doesn't compile because of a malloc.h error

2007-10-02 Thread vittorio
Yes, it was very clear but being an absolute beginner as a programmer I was misled by the presence of both stdlib.h and malloc.h in lpslink55.c (in a nutshell, I thought "Why s it complaining if stdlib.h is there, in the code??"). Anyway, thanks to your help I made it in the end. Ciao Vittorio

[R] How to add legend for image()?

2007-10-02 Thread zhijie zhang
Dear friends, The following is an example to explain my question. I want to get a legend which will show the z-values according to different colors in image() function. x<-sort(runif(10)) #x-coordinates y<-sort(runif(10)) #y-coordinates z<-matrix(runif(100),nrow=10) #attributes values image(

Re: [R] permutations of a binary matrix with fixed margins

2007-10-02 Thread Paul Johnson
Jérôme, As a first attempt, how about the function below. It works (or not) by randomly sorting the rows and columns, then searching the table for "squares" with the corners = matrix(c(1,0,0,1),ncol=2) and subtracting them from 1 to give matrix(c(0,1,1,0),ncol=2) (and vice versa). Randomized matri

Re: [R] How to view the code of a method?

2007-10-02 Thread Stefano Calza
For S3 methods I'd try something like methods(predict) [1] predict.ar*predict.Arima* predict.arima0* predict.glm [5] predict.HoltWinters* predict.lm predict.loess* predict.mlm [9] predict.n

Re: [R] Cannot Install rimage

2007-10-02 Thread Peter Dalgaard
Rick Bilonick wrote: > I'm trying to install rimage in R version 2.5.1 running on Fedora 6 > (kernel 2.6.22.7-57.fc6 with the headers and gcc installed, along with > fftw2 and libjpeg and headers): > > >> install.packages("rimage") >> > Warning in install.packages("rimage") : argument 'lib'

[R] How to view the code of a method?

2007-10-02 Thread Strong
Dear All I am a biginner of R. I have difficulty with reading the code of a method. I am using the vars package to estimate a VAR model and I want to view the code of "predict" method for objects with class attribute "varest". I thougt I could just type the name "predict" without anything

[R] mcv package gamm function Error in chol(XVX + S)

2007-10-02 Thread Dae-Jin Lee
Hi all R users ! I'm using gamm function from Simon Wood's mgcv package, to fit a spatial regression Generalized Additive Mixed Model, as covariates I have the geographical longitude and latitude locations of indexed data. I include a random effect for each district (dist) so the code is fit <- g

[R] Cannot Install rimage

2007-10-02 Thread Rick Bilonick
I'm trying to install rimage in R version 2.5.1 running on Fedora 6 (kernel 2.6.22.7-57.fc6 with the headers and gcc installed, along with fftw2 and libjpeg and headers): > install.packages("rimage") Warning in install.packages("rimage") : argument 'lib' is missing: using '/usr/lib/R/library' tryi

[R] SVM: stratified cross-validation

2007-10-02 Thread Kaustubh Patil
Hi, Is there a way to do stratified cross-validation of Support Vector Machines? Regards, Kaustubh the tools to get online. [[alternative HTML version deleted]] ___

Re: [R] using sprintf with dates

2007-10-02 Thread Alberto Monteiro
stephen bond wrote: > > foot=function(){ > str1=format(Sys.Date,"%Y%m%d") > sprintf("99%-4s%s","nm",str1) > } > > I wanted to have "99nm 20071002" as the output. > Sys.Date is a function. It's perfectly possible to writ

Re: [R] using sprintf with dates

2007-10-02 Thread Jeffrey Horner
stephen bond wrote on 10/02/2007 08:36 AM: > hello, > > Please help with using sprintf with character variables: > The following does not produce what i intended > > foot=function(){ > str1=format(Sys.Date,"%Y%m%d") > sprintf("99%-4s%s","nm

[R] using sprintf with dates

2007-10-02 Thread stephen bond
hello, Please help with using sprintf with character variables: The following does not produce what i intended foot=function(){ str1=format(Sys.Date,"%Y%m%d") sprintf("99%-4s%s","nm",str1) } I wanted to have "99nm 20071002" as the output.

Re: [R] Calculating group means using self-written function

2007-10-02 Thread Vladimir Eremeev
Lauri Nikkinen wrote: > > Suppose I have a following data set. > > y1 <- rnorm(20) + 6.8 > y2 <- rnorm(20) + (1:20*1.7 + 1) > y3 <- rnorm(20) + (1:20*6.7 + 3.7) > y <- c(y1,y2,y3) > var1 <- rep(1:5,12) > z <- rep(1:6,10) > f <- gl(3,20, labels=paste("lev", 1:3, sep="")) > d <- data.frame(var1=v

Re: [R] Calculating group means using self-written function

2007-10-02 Thread Lauri Nikkinen
Well, I finally found a roundabout fun <- function(x, y) sum(x)/max(y) aggregate(vsid$lev, list(vsid$month, vsid$year), fun, y=by(vsid$date, vsid$month, function(x) length(unique(x Thanks, Lauri 2007/10/2, Lauri Nikkinen <[EMAIL PROTECTED]>: > Thanks Petr for your kind answer. I got it now b

Re: [R] Apparently Conflicting Results with coxph

2007-10-02 Thread Kevin E. Thorpe
Kevin E. Thorpe wrote: > Peter Dalgaard wrote: >> Kevin E. Thorpe wrote: >>> Dear List: >>> >>> I have a data frame prepared in the couting process style for including >>> a binary time-dependent covariate. The first few rows look like this. >>> >>> PtNo StartEnd Status Imp >>> 1 1

Re: [R] Calculating group means using self-written function

2007-10-02 Thread Lauri Nikkinen
Thanks Petr for your kind answer. I got it now but it seems that argument y will not be split by "list(vsid$month, vsid$year)" in the aggregate function. I should get number of days in each month in the denominator with "length(unique(y))" but instead I get sum of days in months in the denominator.

Re: [R] Linear Regression

2007-10-02 Thread John Sorkin
OOPPSS, I forgot a right parenthesis fit1<-summary(lm(weight~group-1) ) John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524

Re: [R] Calculating group means using self-written function

2007-10-02 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 02.10.2007 13:19:09: > Thanks Petr, > > Yes, your code seems to work. But when I try to reproduce it with my > original data set > > fun <- function(x, y) sum(x)/length(unique(y)) > aggregate(vsid$lev, list(vsid$month, vsid$yeari), fun, vsid$lev=vsid$date) Shal

Re: [R] Linear Regression

2007-10-02 Thread John Sorkin
Livia, Try the following: fit1<-summary(lm(weight~group-1) summary(fit1) names(fit1) #The code above wil fit the model and print the results. #The statement names(fit1) will give you the components of #the summary such as #coefficients, R.squared adj.R.squared, etc. #You can then access the com

Re: [R] Linear Regression

2007-10-02 Thread Dimitris Rizopoulos
look at ?summary.lm(), and specifically at the `Value' section, e.g., try this: lmFit <- lm(weight ~ group - 1) summ.lmFit <- summary(lmFit) summ.lmFit$coefficients summ.lmFit$r.squared I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Publ

Re: [R] Calculating group means using self-written function

2007-10-02 Thread Lauri Nikkinen
Thanks Petr, Yes, your code seems to work. But when I try to reproduce it with my original data set fun <- function(x, y) sum(x)/length(unique(y)) aggregate(vsid$lev, list(vsid$month, vsid$yeari), fun, vsid$lev=vsid$date) I get Error: syntax error, unexpected EQ_ASSIGN, expecting ',' in "aggreg

[R] Linear Regression

2007-10-02 Thread livia
Hello, I would like to fit a linear regression and when I use summary(), I got the following result: Call: lm(formula = weight ~ group - 1) Residuals: Min 1Q Median 3Q Max -1.0710 -0.4938 0.0685 0.2462 1.3690 Coefficients: Estimate Std. Error t value Pr(>|t|)

Re: [R] splom pairs and groups argument

2007-10-02 Thread deepayan . sarkar
On 10/2/07, GOUACHE David <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to pull off a certain graph using splom, and can't quite get my > panel functions right. > Basically, the equivalent using pairs would be something like this (using > iris data set as an example): > > panel.corval <- funct

Re: [R] Sample fromt he real line

2007-10-02 Thread Duncan Murdoch
On 01/10/2007 3:50 AM, Daniel Polhamus wrote: > Hello R Gurus, > > This is a simple enough question, but I am curious as to whether there's an > answer... Can R generate a random variable uniformly distributed on -Inf to > Inf? Philosophically this doesn't seem possible, and if not, as I imag

Re: [R] building packages on Windows

2007-10-02 Thread Duncan Murdoch
On 01/10/2007 11:45 PM, Edna Bell wrote: > Hi again. > > I'm sure that this is really simple. > > I'm trying to build a package on a Windows Vista machine. I use > Rcmd build --binary test > > but I get the "Please set TMPDIR to a valid temporary directory" > > I tried TMPDIR=c:\temp > but to

Re: [R] plot graph with error bars trouble

2007-10-02 Thread Jim Lemon
Marcelo Laia wrote: > ... > ... but it plot the same point for one > Mutant before the some point of other Mutant in the same Time. > > I uploaded a .ps file to divshare for clarify what I want to explain. > http://www.divshare.com/download/2182890-49c > > and I uploaded a true dataset: > http:/

Re: [R] mean of subset of rows

2007-10-02 Thread darteta001
Thankyou all for your answers, I have decided using aggregate() but I will keep in mind tapply(). I was wondering if it is possible to tell aggregate to use two functions at the same time, i.e., mean() and sd (), or is it better to call aggregate() two times, one for mean, and another for sd and

[R] Odp: Calculating group means using self-written function

2007-10-02 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 02.10.2007 10:44:20: > Hi R-users, > > Suppose I have a following data set. > > y1 <- rnorm(20) + 6.8 > y2 <- rnorm(20) + (1:20*1.7 + 1) > y3 <- rnorm(20) + (1:20*6.7 + 3.7) > y <- c(y1,y2,y3) > var1 <- rep(1:5,12) > z <- rep(1:6,10) > f <- gl(3,20, labels=paste(

[R] problem with ARES

2007-10-02 Thread chevolot
Dear mailing list: I am a new user of R and I would like to use the new ARES package. I have followed the procedure to import a genepopfile and everything seemed to work. However when I ran aresCalc function, I got a message error and I don't know what it means. The error message is object "alri.

Re: [R] Disentagling formulas

2007-10-02 Thread Eik Vettorazzi
I tried formula<-y~X1+X2+X3 update.formula(formula,.-NewRandomEffects~.) and this runs without an error. So I still didn't get the point. You may also need to insulate your new response variable if you want to estimate a model with in fact only one response variable, which ist done by I() as i

[R] splom pairs and groups argument

2007-10-02 Thread GOUACHE David
Hello, I'm trying to pull off a certain graph using splom, and can't quite get my panel functions right. Basically, the equivalent using pairs would be something like this (using iris data set as an example): panel.corval <- function(x, y, digits=2, prefix="", cex.cor,col,pch) { u

[R] Calculating group means using self-written function

2007-10-02 Thread Lauri Nikkinen
Hi R-users, Suppose I have a following data set. y1 <- rnorm(20) + 6.8 y2 <- rnorm(20) + (1:20*1.7 + 1) y3 <- rnorm(20) + (1:20*6.7 + 3.7) y <- c(y1,y2,y3) var1 <- rep(1:5,12) z <- rep(1:6,10) f <- gl(3,20, labels=paste("lev", 1:3, sep="")) d <- data.frame(var1=var1, z=z,y=y, f=f) Using followin

[R] Printing to jpeg (dev.print)

2007-10-02 Thread Marcin Kozak
Hi, This may be an easy question, but let me ask it. When writing a plot to a jpeg file: > plot(runif(30)) > dev.print(file="test.jpeg", device=jpeg, width=600) the plot I receive has gray background, the result on no account I want to receive. The same situation occurs when printing to a bmp fi

Re: [R] convert a tar.gz to a Windows zip

2007-10-02 Thread Martin Maechler
> "JB" == Julien Barnier <[EMAIL PROTECTED]> > on Tue, 02 Oct 2007 09:52:41 +0200 writes: JB> Hi, >> Is there a simple way to convert a Linux produced tar.gz >> file (a package) to a Windows binary zip package, please? JB> If you're on Windows and don't want to do this

Re: [R] convert a tar.gz to a Windows zip

2007-10-02 Thread Peter Dalgaard
Julien Barnier wrote: > Hi, > > >> Is there a simple way to convert a Linux produced tar.gz file (a >> package) to a Windows binary zip package, please? >> > > If you're on Windows and don't want to do this automatically with a > command line, you can use 7zip : > > http://www.7-zip.org/ >

Re: [R] convert a tar.gz to a Windows zip

2007-10-02 Thread Julien Barnier
Hi, > Is there a simple way to convert a Linux produced tar.gz file (a > package) to a Windows binary zip package, please? If you're on Windows and don't want to do this automatically with a command line, you can use 7zip : http://www.7-zip.org/ HTH, Julien -- Julien Barnier Groupe de recher

  1   2   >