[R] a high-level command for drawing a multiple series graph with each series having a label

2008-06-21 Thread Mark Farnell
I wish to draw a graph representing multiple series (sets of x,y points). Each series has its own label and points within each series are joined by a line ordered by their X cooridnate. I would also like a legend automatically showing which each series is. Which high-level command can serve

Re: [R] Problems with lm()

2008-06-21 Thread Hsin-Ya Lee
Dear Dr. Andrew Robinson: Thanks for your reply. In my data, subject is nested within sequence. According to Dr. Christoph's reply, I have change the sequence data. It seems not work in R. However, I am sure that I run the same data with GLM in SPSS that I posted in first time. I really do

Re: [R] unable to update the matrix values within a function

2008-06-21 Thread Wacek Kusnierczyk
Ken Liu wrote: Hi, I don't understand why this doesn't work: matTest - matrix(nrow=3, ncol=3) testMove - function(I, J){ for(i in 1:I){ for(j in 1:J){ matTest[i, j] - i+j } } } testMove(2, 3) matTest Why the elements of the matrix matTest are

Re: [R] unable to update the matrix values within a function

2008-06-21 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: Ken Liu wrote: Hi, I don't understand why this doesn't work: matTest - matrix(nrow=3, ncol=3) testMove - function(I, J){ for(i in 1:I){ for(j in 1:J){ matTest[i, j] - i+j } } } testMove(2, 3) matTest Why the elements

[R] boxplot problem

2008-06-21 Thread Paul Adams
Hello everyone, I am trying to plot a boxplot but am coming up with the error : could not find function dat I have used the following code. dat-read.table(file=C:\\Documents and Settings\\...txt,header=T,row.names=1,blank.lines.skip=F,na.strings=NA) file.show(file=C:\\Documents and

Re: [R] Scatter plot transparency

2008-06-21 Thread Prof Brian Ripley
Please see the footer of this message. What do you want to be transparent, and what did you use to try to get it (there are many possibilities)? What OS and version of R is this? Note that the default value of bg for the png() and tiff() devices is white, and the Windows version of the

Re: [R] Problems with lm()

2008-06-21 Thread Dr. Christoph Scherber
Dear Hsin-Ya, Then it might be that you have checked Type 3 sums of squares in SPSS, while R uses type 1 by default. Dear Dr. Andrew Robinson: Thanks for your reply. In my data, subject is nested within sequence. According to Dr. Christoph's reply, I have change the sequence data. It

Re: [R] Scatter plot transparency

2008-06-21 Thread Anh Tran
Thanks, I think I've got it on Mac. Will try with my windows station tomorrow. Best, Anh Tran On Jun 21, 2008, at 12:05 AM, Prof Brian Ripley wrote: Please see the footer of this message. What do you want to be transparent, and what did you use to try to get it (there are many

Re: [R] Problems with lm()

2008-06-21 Thread Peter Dalgaard
oops, this got sent as reply to Andrew only Andrew Robinson wrote: In your data, subject is nested within sequence. Was that your intention? Presumably yes. This looks like a standard cross-over design. I fail to see what the interaction between subject and sequence might mean, so I also

Re: [R] Convert character string to number

2008-06-21 Thread Hans-Jörg Bibiko
On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1/4) to yyy - c(0.5, 0.25) , but as.numeric didn't work for me. Could anyone give me a hint please? There are many many ways, and they're depending on the structure of xxx. If you only

Re: [R] cutting out numbers from vectors

2008-06-21 Thread Hans-Jörg Bibiko
On 20.06.2008, at 19:27, calundergrad wrote: i have a vector with a string of number e.g [1] 0113001 001130011000 001130012000 001130013000 001130016000 [6] 001130018000 i want a vector with the same numbers except with the last three digits of every factor cut off. e.g [1]

Re: [R] Convert character string to number

2008-06-21 Thread Kenn Konstabel
another way to do it is using eval and parse: yyy-numeric() for(i in 1:length(xxx)) yyy[i] - eval(parse(text=xxx[i])) or ... unlist(lapply(as.list(xxx), function(x) eval(parse(text=x then xxx can contain any valid expressions (not necessarily fractions) Kenn On Sat, Jun 21, 2008 at 12:44

[R] ubuntu repository for R

2008-06-21 Thread Graham Smith
Maybe this is more a Ubuntu question,but... I am trying to get synaptic to work with R I have added http://cran.uk.r-project.org/bin/linux/ubuntu as the URL and hardy/ as the distribution. But when I reload the repositories, I get an error Failed to fetch

Re: [R] The Green Book and its relevance to R

2008-06-21 Thread Dr. Christoph Scherber
Dear Ben, Do you mean Statistical Computing by Crawley? In that case, there is a web appendix showing some differences between R and S-Plus. There is also John Fox´s Book Companion to Applied Linear Regression that compares R and S-Plus, and Richard Heiberger´s book (Heiberger Holland)

Re: [R] Convert character string to number

2008-06-21 Thread Peter Dalgaard
Kenn Konstabel wrote: another way to do it is using eval and parse: yyy-numeric() for(i in 1:length(xxx)) yyy[i] - eval(parse(text=xxx[i])) or ... unlist(lapply(as.list(xxx), function(x) eval(parse(text=x or even sapply(parse(text=xxx), eval) (Beware that this can have unforeseen

Re: [R] clicking on plot and recording XY coords

2008-06-21 Thread jim holtman
Is this something like you want? I assume you could also create a dialog box: number.clicks-4 my.coords-NULL for (i in 1:number.clicks) { plot(0,0, type=n) seg1-arrows(-0.5,-1,0.5,0, col=1) seg2-arrows(0,-1,-0.3,0.3, col=2) seg3-arrows(0.2,-0.7,-0.5,0, col=4) if

Re: [R] Convert character string to number

2008-06-21 Thread Wacek Kusnierczyk
... or try to avoid unnecessarily complex code, and just type sapply(parse(text=xxx), eval) vQ Kenn Konstabel wrote: another way to do it is using eval and parse: yyy-numeric() for(i in 1:length(xxx)) yyy[i] - eval(parse(text=xxx[i])) or ... unlist(lapply(as.list(xxx), function(x)

Re: [R] Combine colors and shading lines

2008-06-21 Thread jim holtman
You can play around with something like this to control the plots and to add color to them: data(HairEyeColor) a - as.table( apply(HairEyeColor, c(1,2), sum) ) a1-a[1:2,] library(lattice) library(reshape) x - melt(a1) p1 - barchart(value ~ Eye, group=Hair, data=x) p2 - barchart(value ~ Hair,

Re: [R] boxplot problem

2008-06-21 Thread jim holtman
What is this statement supposed to do: gc-dat(1:19) You are trying to call the function 'dat' with a vector of 19 values. Is this what you intended? If the function 'dat' does not exist, that is why you are getting the error. On Sat, Jun 21, 2008 at 2:46 AM, Paul Adams [EMAIL PROTECTED]

Re: [R] Convert character string to number

2008-06-21 Thread Wacek Kusnierczyk
Hans-Jörg Bibiko wrote: On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1/4) to yyy - c(0.5, 0.25) , but as.numeric didn't work for me. Could anyone give me a hint please? There are many many ways, and they're depending on the

Re: [R] handling the output of strsplit

2008-06-21 Thread Mark Difford
Hi Denis, h = c(3h30, 6h30, 9h40, 11h25, 14h00, 15h55, 23h) I could not figure out how to use chron to import this into times, so I tried to extract the hours and minutes on my own. Look at ?strptime for this: ## strptime(6h30, format=%Ih%M) [1] 2008-06-21

Re: [R] stepAIC {MASS}

2008-06-21 Thread Frank E Harrell Jr
Nathan Leon Pace, MD, MStat wrote: In a generalized linear model with k covariates, there are 2(kth power) - 1 possible models (excluding interactions). Awhile ago a posting to R-help suggested Model Selection and Multimodel Inference, 2nd ed, by Burnham and Anderson as a good source for

Re: [R] Error in bugs.run -- R2WinBUGS

2008-06-21 Thread Uwe Ligges
Yes: Please do what the error message tells you to do. Uwe Ligges Cleber Nogueira Borges wrote: Hi, I tried to use MethComp library and this library make use of the WinBUGS by R2WinBuGUS, but I get the follow error in bugs.run: *Error in bugs.run(n.burnin, bugs.directory, WINE = WINE,

[R] converting an R function into VBA

2008-06-21 Thread Eric yang
Hi everyone, I want to convert an R function into VBA for calculating the eigenvectors and eigenvalues of a matrix using the Power Method. The function is: PowerMethod - function(x, tolerance) {     my.mat - var(x[,-1], na.method=available)     matSize - dim(my.mat)[1]     eigenVec -

Re: [R] Convert character string to number

2008-06-21 Thread Gabor Grothendieck
On Sat, Jun 21, 2008 at 8:31 AM, Wacek Kusnierczyk [EMAIL PROTECTED] wrote: Hans-Jörg Bibiko wrote: On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1/4) to yyy - c(0.5, 0.25) , but as.numeric didn't work for me. Could anyone give me a

Re: [R] Error in bugs.run -- R2WinBUGS

2008-06-21 Thread Cleber Nogueira Borges
Hello Uwe Ligges, Thanks for your attention I run the code with option: debug=T, so I get the log file! I think that the stone in my shoe is: educational version cannot do this model... Am I right? TIA Cleber --

Re: [R] a high-level command for drawing a multiple series graph with each series having a label

2008-06-21 Thread John Kane
?plot ?lines used together. Note you need to set type=l in plot --- On Sat, 6/21/08, Mark Farnell [EMAIL PROTECTED] wrote: From: Mark Farnell [EMAIL PROTECTED] Subject: [R] a high-level command for drawing a multiple series graph with each series having a label To: R-help@r-project.org

Re: [R] Error in bugs.run -- R2WinBUGS

2008-06-21 Thread Uwe Ligges
Cleber Nogueira Borges wrote: Hello Uwe Ligges, Thanks for your attention I run the code with option: debug=T, so I get the log file! I think that the stone in my shoe is: educational version cannot do this model... Am I right? I think so, so why do you not simply get the full version of

Re: [R] a high-level command for drawing a multiple series graph with each series having a label

2008-06-21 Thread hadley wickham
On Sat, Jun 21, 2008 at 1:00 AM, Mark Farnell [EMAIL PROTECTED] wrote: I wish to draw a graph representing multiple series (sets of x,y points). Each series has its own label and points within each series are joined by a line ordered by their X cooridnate. I would also like a legend

[R] using the stepfun to plot histogram outline.

2008-06-21 Thread Karin Lagesen
Hello list:) I have lots of values which I would like to get a histogram outline out of. An example of what I am talking about: testdata = runif(100) bbb = seq(0,1, by = 0.01) hist(testdata, breaks = bbb) I would like to get the outline of the resulting histogram. Now, I think that I can do

Re: [R] using the stepfun to plot histogram outline.

2008-06-21 Thread hadley wickham
On Sat, Jun 21, 2008 at 3:36 AM, Karin Lagesen [EMAIL PROTECTED] wrote: Hello list:) I have lots of values which I would like to get a histogram outline out of. An example of what I am talking about: testdata = runif(100) bbb = seq(0,1, by = 0.01) hist(testdata, breaks = bbb) I would

Re: [R] Convert character string to number

2008-06-21 Thread Marc Schwartz
on 06/21/2008 09:18 AM Gabor Grothendieck wrote: On Sat, Jun 21, 2008 at 8:31 AM, Wacek Kusnierczyk [EMAIL PROTECTED] wrote: Hans-Jörg Bibiko wrote: On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1/4) to yyy - c(0.5, 0.25) , but as.numeric

[R] How to change min and max of plot axis

2008-06-21 Thread Luis Orlindo Tedeschi
All; this might be an easy question but I cannot make it work. I would like to set the min and max of the y axis of a plot. I know I have to use par(usr), but after I do the plot() the axis values get changed. x-rnorm(20) Y-x+rnorm(20,0,.1) plot(y,x) par(usr) # let's say I have -2.8 1.15 -2.8

Re: [R] How to change min and max of plot axis

2008-06-21 Thread Duncan Murdoch
On 21/06/2008 11:25 AM, Luis Orlindo Tedeschi wrote: All; this might be an easy question but I cannot make it work. I would like to set the min and max of the y axis of a plot. I know I have to use par(usr), but after I do the plot() the axis values get changed. x-rnorm(20) Y-x+rnorm(20,0,.1)

Re: [R] How to change min and max of plot axis

2008-06-21 Thread Marc Schwartz
on 06/21/2008 10:25 AM Luis Orlindo Tedeschi wrote: All; this might be an easy question but I cannot make it work. I would like to set the min and max of the y axis of a plot. I know I have to use par(usr), but after I do the plot() the axis values get changed. x-rnorm(20) Y-x+rnorm(20,0,.1)

Re: [R] converting an R function into VBA

2008-06-21 Thread Kenn Konstabel
Can't you just import data from Excel using RODBC, then use your function in R, and then write the results to Excel again? It would be much less painful than doing it in VBA... Otherwise, look for MMult and Transpose and similar things in VB help, and then ask some VB experts... Kenn On Sat,

Re: [R] ubuntu repository for R

2008-06-21 Thread Marielle
I am trying to get synaptic to work with R I have added http://cran.uk.r-project.org/bin/linux/ubuntu as the URL and hardy/ as the distribution. Try a different mirror, I used http://cran-mirror.cs.uu.nl/. When you try apt-get update, you'll get a warning (that's better than an error ;) W:

Re: [R] Convert character string to number

2008-06-21 Thread Hans-Jörg Bibiko
On 21.06.2008, at 17:25, Marc Schwartz wrote: on 06/21/2008 09:18 AM Gabor Grothendieck wrote: On Sat, Jun 21, 2008 at 8:31 AM, Wacek Kusnierczyk [EMAIL PROTECTED] wrote: Hans-Jörg Bibiko wrote: On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2,

[R] Generating groupings of ordered observations

2008-06-21 Thread Gavin Simpson
Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of splitting these 6 ordered observations in g groups, where g = 1, ..., 6. Groups can only be formed by adjacent observations, so observations 1 and

Re: [R] ubuntu repository for R

2008-06-21 Thread Graham Smith
Marielle, Thanks for this. I think I have done as you suggest but still get the public key error. Do I need to reboot to get it to work: here is the script: [EMAIL PROTECTED]:~$ gpg --keyserver subkeys.pgp.net --recv E2A11821 gpg: requesting key E2A11821 from hkp server subkeys.pgp.net gpg: key

Re: [R] ubuntu repository for R

2008-06-21 Thread Graham Smith
Dirk, Thanks for this, in fact I did notice the error after posting. I didn't know there was an r-sig-debian list, I shall join and use it for any future questions of this type. Graham 2008/6/21 Dirk Eddelbuettel [EMAIL PROTECTED]: On Sat, Jun 21, 2008 at 06:03:39PM +0100, Graham Smith

[R] Coloring Stripchart Points, or Better, Lattice Equivalent

2008-06-21 Thread Bryan Hanson
Hi All. I have the commands below to create a stripchart/plot. I was hoping to color the points in the plot by yr, and use a symbol that varied with resp. However, the outcome makes it appear as though the point by point col and pch data is not being passed properly. Any suggestions? And

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Charles C. Berry
On Sat, 21 Jun 2008, Gavin Simpson wrote: Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of splitting these 6 ordered observations in g groups, where g = 1, ..., 6. Groups can only be formed by

Re: [R] Adding columns of Aggregates to existing dataframe

2008-06-21 Thread jim holtman
This should do it for you: x - read.table(textConnection(ID1 ID2 + A1B3 + A1B4 + A1B3 + A1B3 + A2B1 + A2B1 + A2B4 + A3B2 + A3B2 + A5B1 + A5B1 + A5B6 + A5B4 + A6B2), header=TRUE) cbind(x, countID1=ave(seq_along(x$ID1), x$ID1, FUN=length),

[R] question on rgl.surface

2008-06-21 Thread Mark Kimpel
I'd like to use rgl.surface (or some other function if more appropriate) to create a horizontal and vertical transparent grey slice (plane) running through both the x and y origins and extending across the z axis, i.e. the 3-d equivalent of the normal 2-d coordinate axes we are all familiar with.

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Gavin Simpson
Dear Chuck, That is, quite simply, superb! The members of this list never cease to amaze me, and your response is no exception. As an aside, does this type of problem come under a particular name or topic in mathematics? The ordering need not be exactly as I had it in my example --- that just

Re: [R] ubuntu repository for R

2008-06-21 Thread ctu
Hi All R+Linux users, I am very new to Linux and I also have the (dis)similar problem. I try to install R 2.7.0 on Ubuntu. But I only got the R 2.6.2 version. Could anyone tell me how to uninstall R 2.6.2 and install R2.7.0 on Ubuntu. many thanks in advance. Chunhao Quoting Graham

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Charles C. Berry
On Sat, 21 Jun 2008, Gavin Simpson wrote: Dear Chuck, That is, quite simply, superb! The members of this list never cease to amaze me, and your response is no exception. As an aside, does this type of problem come under a particular name or topic in mathematics? Yes. Combinatorics. See

Re: [R] ubuntu repository for R

2008-06-21 Thread Dirk Eddelbuettel
On Sat, Jun 21, 2008 at 03:08:51PM -0500, [EMAIL PROTECTED] wrote: Hi All R+Linux users, I am very new to Linux and I also have the (dis)similar problem. I try to install R 2.7.0 on Ubuntu. But I only got the R 2.6.2 version. Could anyone tell me how to uninstall R 2.6.2 and install R2.7.0

Re: [R] error related to approxfun in R 2.7.0

2008-06-21 Thread Martin Maechler
KM == Karl Marx [EMAIL PROTECTED] on Thu, 19 Jun 2008 23:01:31 +0200 writes: KM I'm testing R version 2.7.0 on windows and there seems KM to be a compatibility issue with objects that were KM created by approxfun in older versions. As long as the KM objects were created in

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Gabor Grothendieck
On Sat, Jun 21, 2008 at 12:40 PM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of splitting these 6 ordered observations in g groups, where g = 1, ...,

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Gabor Grothendieck
I meant 0:31, not 0:15. On Sat, Jun 21, 2008 at 5:56 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: On Sat, Jun 21, 2008 at 12:40 PM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Gavin Simpson
On Sat, 2008-06-21 at 17:56 -0400, Gabor Grothendieck wrote: On Sat, Jun 21, 2008 at 12:40 PM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of

Re: [R] Generating groupings of ordered observations

2008-06-21 Thread Charles C. Berry
On Sat, 21 Jun 2008, Gavin Simpson wrote: On Sat, 2008-06-21 at 17:56 -0400, Gabor Grothendieck wrote: On Sat, Jun 21, 2008 at 12:40 PM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I

Re: [R] question on rgl.surface

2008-06-21 Thread Duncan Murdoch
On 21/06/2008 2:48 PM, Mark Kimpel wrote: I'd like to use rgl.surface (or some other function if more appropriate) to create a horizontal and vertical transparent grey slice (plane) running through both the x and y origins and extending across the z axis, i.e. the 3-d equivalent of the normal

[R] eliminating string from a char vector

2008-06-21 Thread milton ruser
Hi there, I have a list of filenames like a-c(file1.dbf, file32.dbf, myfile_temp.dbf) and I would like to remove the .dbf string from all records and obtain somethink like file1 file32 myfile_temp Thanks in advance, miltinho brazil [[alternative HTML version deleted]]

Re: [R] eliminating string from a char vector

2008-06-21 Thread Marc Schwartz
on 06/21/2008 09:19 PM milton ruser wrote: Hi there, I have a list of filenames like a-c(file1.dbf, file32.dbf, myfile_temp.dbf) and I would like to remove the .dbf string from all records and obtain somethink like file1 file32 myfile_temp Thanks in advance, miltinho brazil As is usually

Re: [R] Re move row.names column in dataframe

2008-06-21 Thread Berend Hasselman
tonyxv wrote: Hello, aa-c(1,1,2,2,3,3,4,4,5,5,6,6) bb-c(56,56,33,33,53,53,20,20,63,63,9,9) cc-data.frame(aa,bb) uniquedf - unique(cc) View(uniquedf) Why does the column row.names appear in the new dataframe and how do I get rid of it. uniquedf$row.names - NULL does not