Re: [R] cbind() and factors.

2004-12-10 Thread Gabor Grothendieck
michael watson (IAH-C bbsrc.ac.uk> writes: : : Hi : : I'm seeing some "odd" behaviour with cbind(). My code is: : : > cat <- read.table("cogs_category.txt", sep="\t", header=TRUE, : quote=NULL, colClasses="character") : > colnames(cat) : [1] "Code""Description" : > is.factor(cat$Code)

Re: [R] finding the most frequent row

2004-12-10 Thread Gabor Grothendieck
Jean Eid chass.utoronto.ca> writes: : : You can do the following also : : : X <- matrix(c(1,2,1,2,1,3,1,4), ncol=2) : Y<-unique(X) : Y[which.max(apply(Y, 1,function(i) sum(apply(matrix(1:nrow(X)), : 1,function(x) identical(X[x,], i[1:2]),] : : I do not know what your strategy is when ther

RE: [R] predict.randomForest

2004-12-10 Thread Liaw, Andy
Can you show how you called randomForest() and predict.randomForest()? The error message came from the code: if (is.data.frame(x)) { [changing ordered factors to numeric...] cat.new <- sapply(x, function(x) if (is.factor(x) && !is.ordered(x)) length(l

[R] predict.randomForest

2004-12-10 Thread Tim Howard
I have a data.frame with a series of variables tagged to a binary response ('present'/'absent'). I am trying to use randomForest to predict present/absent in a second dataset.After a lot a fiddling (using two data frames, making sure data types are the same, lots of testing with data that work

RE: [R] Adding a polygon to a time series plot

2004-12-10 Thread Andy Bunn
Arggh! start and end. Of course. How stupid of me. And I'm not going to interpolate with smooth.spline, but thanks for the warning. Sloppy language. Thanks, Andy > -Original Message- > From: Liaw, Andy [mailto:[EMAIL PROTECTED] > Sent: Friday, December 10, 2004 2:49 PM > To: 'Andy Bunn';

RE: [R] R/S-plus help

2004-12-10 Thread Liaw, Andy
You've got the wrong list: This is R-help, not S-news. Besides, wouldn't such questions be covered in the S-PLUS Programmer's Guide? Andy > From: [EMAIL PROTECTED] > > Hi, > > Does anybody know if S-plus Connect/C++ lib can handle > complex number? I need to use complex matrix. > > Thanks

RE: [R] Adding a polygon to a time series plot

2004-12-10 Thread Liaw, Andy
> From: Andy Bunn > > Preamble: Sorry for being dense. > > Now that that's done, here are my questions. > > I want to put a polygon on a plot of a time series. I'm going > to add lines > from a smooth.spline interpolation and other annotation to Please note: smooth.spline() is for _smoothing_

[R] R/S-plus help

2004-12-10 Thread Weiming.Zhang
Hi, Does anybody know if S-plus Connect/C++ lib can handle complex number? I need to use complex matrix. Thanks vey much. wz [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-he

[R] Adding a polygon to a time series plot

2004-12-10 Thread Andy Bunn
Preamble: Sorry for being dense. Now that that's done, here are my questions. I want to put a polygon on a plot of a time series. I'm going to add lines from a smooth.spline interpolation and other annotation to it. But here's the general idea: # Start code n <- 121 dat <- rnorm(n)

Re: [R] subset bug?

2004-12-10 Thread Mike Saunders
Bert: Thanks for your reply. Actually, "mat" was a data.frame, not a matrix. Mike - Original Message - From: "Berton Gunter" <[EMAIL PROTECTED]> To: "'Mike Saunders'" <[EMAIL PROTECTED]>; "'R Help'" <[EMAIL PROTECTED]> Sent: Friday, December 10, 2004 11:57 AM Subject: RE: [R] subset bug?

RE: [R] subset bug?

2004-12-10 Thread Berton Gunter
The subset() Help file says "The select argument exists only for the method for data frames ..." So if mat is a matrix and not a data.frame, this might be the source of your problems. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is

[R] R Reference Card (especially useful for Newbies)

2004-12-10 Thread Berton Gunter
Newbies (and others!) may find the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf useful. It categorizes and organizes a bunch of R's (S's) basic, most used functions so that they can be easily found. For example, paste() is under the "Strings"

RE:Arguments to a call-- was [R] finding the most frequent row

2004-12-10 Thread Berton Gunter
> Here's something that works. I'm sure there are better solutions (in > particular the paste part - I couldn't figure out how to avoid typing > a[i,1], ..., a[i,10]). This is a language issue that arises frequently. One standard approach is to use do.call() as in: ... result <- do.call("paste",a

RE: [R] Which FM should beginners R? A suggestion.

2004-12-10 Thread Martin Maechler
> "RichOK" == Richard A O'Keefe <[EMAIL PROTECTED]> > on Tue, 7 Dec 2004 14:35:22 +1300 (NZDT) writes: RichOK> I've made one important change to RichOK> http://www.cs.otago.ac.nz/staffpriv/ok/R-help.txt now that the server there is responsive again,... Thank you very much, Ri

Re: [R] HTML help index generation problem with R under Windows

2004-12-10 Thread Uwe Ligges
Sergei Zuyev wrote: Hello, I am wondering if there has been a solution to the following issue with R under Windows (see also thread to PR#6662 in this mailing list: http://tolstoy.newcastle.edu.au/R/devel/04a/0550.html ) I am using R for teaching students Statistics, so they are working with a u

Re: [R] cbind() and factors.

2004-12-10 Thread Dieter Menne
Probably you called the build-in rainwbow-function, which returns a string. >str(rainbow(10)) chr "FF" Dieter Menne __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-proje

RE: [R] finding the most frequent row

2004-12-10 Thread Jean Eid
You can do the following also X <- matrix(c(1,2,1,2,1,3,1,4), ncol=2) Y<-unique(X) Y[which.max(apply(Y, 1,function(i) sum(apply(matrix(1:nrow(X)), 1,function(x) identical(X[x,], i[1:2]),] I do not know what your strategy is when there are multiple maxima i.e two different rows appear at

Re: [R] cbind() and factors.

2004-12-10 Thread Rolf Turner
This is of the nature of an FAQ. Data frames coerce character vectors into factors. If you want a character vector to stay that way (and not become a factor) wrap in up in ``I()'': cat <- cbind(cat,Color=I(rainbow(nrow(cat (There's no need to quote the name ``Color'' in the foregoi

Re: [R] cbind() and factors.

2004-12-10 Thread Stephane DRAY
cat is a data.frame, so cbind is use for a data.frame and ?data.frame tell us that: Character variables passed to 'data.frame' are converted to factor columns unless protected by 'I'. PS : it is not good ides to call your data.frame cat as there is a cat function. At 09:19 10/12/2004, mich

[R] strange gee behavior

2004-12-10 Thread Max_Kuhn
I'm using R 1.9.1 on suse server v9 enterprise with the gee package version 4.13-10. I have code that runs in an automated script. It uses the gee function from the gee package. The script is run quite often without error. I have a problem where the script locks up R when calling this function (i

[R] cbind() and factors.

2004-12-10 Thread michael watson \(IAH-C\)
Hi I'm seeing some "odd" behaviour with cbind(). My code is: > cat <- read.table("cogs_category.txt", sep="\t", header=TRUE, quote=NULL, colClasses="character") > colnames(cat) [1] "Code""Description" > is.factor(cat$Code) [1] FALSE > is.factor(cat$Description) [1] FALSE > is.factor(rain

Re: [R] finding the most frequent row

2004-12-10 Thread Uwe Ligges
bogdan romocea wrote: Here's something that works. I'm sure there are better solutions (in particular the paste part - I couldn't figure out how to avoid typing a[i,1], ..., a[i,10]). a <- matrix(nrow=1000,ncol=10) for (i in 1:1000) for (j in 1:10) a[i,j] <- sample(1:0,1) b

RE: [R] Returning to normal after call to layout()

2004-12-10 Thread Jean Eid
Here's tow examples that do what you want (the way I understand them). layout(matrix(c(1,0,1,0), byrow = TRUE)) plot(10:100) par(xpd=NA) co <- par("usr") legend(co[1], -10, legend=c("Hello long time no see","\n" , "and My day was great","\n", "How was yours"), text.width=95, col="red",, text.col

RE: [R] finding the most frequent row

2004-12-10 Thread bogdan romocea
Here's something that works. I'm sure there are better solutions (in particular the paste part - I couldn't figure out how to avoid typing a[i,1], ..., a[i,10]). a <- matrix(nrow=1000,ncol=10) for (i in 1:1000) for (j in 1:10) a[i,j] <- sample(1:0,1) b <- vector(mode="char

Re: [R] 2.01

2004-12-10 Thread Duncan Murdoch
On Thu, 9 Dec 2004 16:46:27 -0600, "Bang" <[EMAIL PROTECTED]> wrote : >I recently installed the new base. > >Code that I had been successfully using for a spatial model is now giving >the following message when it reads the "Y" variable in the command: > >y <- model.response(mf, "numeric") > >The

[R] subset bug?

2004-12-10 Thread Mike Saunders
I ran into a problem with "subset" while working at home that I am not sure is a bug or not. I defined a custom function to take a data frame of tree positions, sizes, and types (containing the columns TRT, COMP, PLOT, X, Y, DBH and CON) and wanted to make a stem map of the plot using different

RE: [R] Returning to normal after call to layout()

2004-12-10 Thread Brian D Ripley
On Fri, 10 Dec 2004, michael watson (IAH-C) wrote: > Hi Petr > > Yes thanks I did get your response and it was helpful. However, I have > now resorted to using barplot() to draw a legend (as all I wanted was > colored boxes and text) and it works very well for my needs. > > Basically, with layout

Re: [R] Porting optimisation setup from Excel Solver to R

2004-12-10 Thread Brian D Ripley
On Fri, 10 Dec 2004, Puneet Singh wrote: > Hi all, > > I am currently optimising a small portfolio I have > created as a part of my research project in Excel. I > am unable to find the appropriate package to port this > into R. My problem set up is as follows > > Minimise ABS(Sum(Xi-Xi')+10*Sum(Xi

RE: [R] Returning to normal after call to layout()

2004-12-10 Thread Petr Pikal
On 10 Dec 2004 at 12:20, michael watson (IAH-C) wrote: > Hi Petr > > Yes thanks I did get your response and it was helpful. However, I > have now resorted to using barplot() to draw a legend (as all I wanted > was colored boxes and text) and it works very well for my needs. > > Basically, wit

RE: [R] Returning to normal after call to layout()

2004-12-10 Thread michael watson \(IAH-C\)
Hi Petr Yes thanks I did get your response and it was helpful. However, I have now resorted to using barplot() to draw a legend (as all I wanted was colored boxes and text) and it works very well for my needs. Basically, with layout() I'm not getting what I would expect, which may be a problem w

Re: [R] Returning to normal after call to layout()

2004-12-10 Thread Petr Pikal
On 10 Dec 2004 at 11:47, michael watson (IAH-C) wrote: > Hi > > I have a function which draws a plot, using the layout() function to > divide the screen into two parts. The function works fine, but then > my next call to plot() draws the plot in the first section of the plot > I've just drawn

[R] Porting optimisation setup from Excel Solver to R

2004-12-10 Thread Puneet Singh
Hi all, I am currently optimising a small portfolio I have created as a part of my research project in Excel. I am unable to find the appropriate package to port this into R. My problem set up is as follows Minimise ABS(Sum(Xi-Xi')+10*Sum(XiMi)/Mavg) Subject to: 0 <= Xi <= 0.05 ABS(Sum(Xi)) = 0.

[R] Returning to normal after call to layout()

2004-12-10 Thread michael watson \(IAH-C\)
Hi I have a function which draws a plot, using the layout() function to divide the screen into two parts. The function works fine, but then my next call to plot() draws the plot in the first section of the plot I've just drawn using layout() - whereas what I want it to do is create a new plot. I

Re: [R] bar charts

2004-12-10 Thread Roger Bivand
On Fri, 10 Dec 2004, Leonardo Lami wrote: > Hi, > I'd like plot a bar graphic of a array. > I'd like to have the values of the single columns as juxtaposed bars (like in > "barplot" with beside=TRUE) and I'd like to have the values of the single > columns expressed like percentage of the sum of

[R] Bar chart

2004-12-10 Thread Leonardo Lami
Hi, I'd like plot a bar graphic of a array. I'd like to have the values of the single columns as juxtaposed bars (like in "barplot" with beside=TRUE) and I'd like to have the values of the single columns expressed like percentage of the sum of the coloumn. In this way all the bars are composed b

[R] bar charts

2004-12-10 Thread Leonardo Lami
Hi, I'd like plot a bar graphic of a array. I'd like to have the values of the single columns as juxtaposed bars (like in "barplot" with beside=TRUE) and I'd like to have the values of the single columns expressed like percentage of the sum of the coloumn. In this way all the bars are composed b

[R] nlme and pnlsTol

2004-12-10 Thread Dieter Menne
Dear nlme-lovers, I do a fit fo a 3-parameter fit to physiological data with nlme: EmptD<-deriv(~(vol+slope*t)*exp(-t/tempt)... The approach described in Pinheiro/Bates by using nlsList as a first approximator was somewhat unstable (many NA), but a direct fit converges quickly and fits look good

Re: [R] lattice graphics empty in Sweave

2004-12-10 Thread Fernando Henrique Ferraz P. da Rosa
Thomas Petzoldt writes: > === lattice.Rnw== > \documentclass[a4paper, dvips]{article} > \begin{document} > > <>= > library(lattice) > data(iris) > xyplot(Sepal.Length~Sepal.Width|Species, data=iris) > @ > > \end{document} > ===

[R] lattice graphics empty in Sweave

2004-12-10 Thread Thomas Petzoldt
Hello, I have problems using lattice graphics together with Sweave under Windows XP and R 2.0.0; 2.0.1 Patched; 2.1.0 devel respectively. Base graphics are o.k., but for lattice graphics empty files (.eps and .pdf) are generated. The only workaround I found was to write and read the respective f

RE: [R] Create a plot legend in a new window

2004-12-10 Thread michael watson \(IAH-C\)
Just for the records (and if anyone ever wants to find the "solution"), I solved my own problem (well sort of) through imaginative use of the barplot command: > barplot(rep(1,4),horiz=TRUE,names.arg=rev(c("this","is","my","legend")), col=rev(rainbow(4)), axes=FALSE,las=2) Produces a very nice, re

Re: [R] Is k equivalent to k:k ?

2004-12-10 Thread Martin Maechler
I'm diverting to R-devel, where this is really more appropriate. Here (R-help) only a shorter version: > "RichOK" == Richard A O'Keefe <[EMAIL PROTECTED]> > on Fri, 10 Dec 2004 14:37:16 +1300 (NZDT) writes: RichOK> In this discussion of seq(), can anyone explain to RichOK> me

Re: [R] "sequence of factor settings"?

2004-12-10 Thread Christian Schulz
Phil and Andy, many thanks for your help's! regrads,christian Phil Spector wrote: Christian - Perhaps this is what you are looking for: > dat = NULL > for(i in 1:8)dat = cbind(dat,sample(1:5,size=10,replace=TRUE)) > dat = data.frame(dat) > tt = table(dat) > tt1 = data.frame(tt) > tt1

Re: [R] Mixed effects model help

2004-12-10 Thread Martin Maechler
> "Chris" == <[EMAIL PROTECTED]> > on Thu, 9 Dec 2004 22:59:13 - writes: Chris> I am attempting to set up a mixed effects model, with Chris> one factor fixed (put in as.factor, with three factor Chris> levels) and one factor random(put in as.factor, with Chris> fo

RE: [R] Create a plot legend in a new window

2004-12-10 Thread Petr Pikal
Hi Michael I cannot find other option than 1. to go through legend code and modify it according to your wish (especially drawing parts) 2. to use rect and text for making your own legend 3. experiment with legend settins to produce what you want Cheers Petr On 9 Dec 2004 at