[R] ploting the two sets of data side by side

2005-12-07 Thread Subhabrata
Hello R-users, I am new to R-commands. I have two sets of data: x - c(7, 7 , 8, 9, 15, 17, 18) y - c(7, 8, 9, 15, 17, 19, 20, 20, 25, 23, 22) I have used 'cut' command to seperate them as follows a - cut(x, breaks =c(0,5,10,20,25,30)) b - cut(y, breaks =c(0,5,10,20,25,30)) table(a) a

Re: [R] R newbie...

2005-12-07 Thread David Hajage
Thank you for all your answers... I solved my problem thanks to you all ! david 2005/12/6, paul sorenson [EMAIL PROTECTED]: Return something that can hold more than one value, eg: calculate - function(x, y) { list(a=x+y, b=x-y) } David Hajage wrote: Thank you for your answer.

Re: [R] ploting the two sets of data side by side

2005-12-07 Thread Jacques VESLOT
try : barplot(do.call(rbind,lapply(list(x,y), function(x) table(cut(x, breaks =c(0,5,10,20,25,30),beside=T) Subhabrata a écrit : Hello R-users, I am new to R-commands. I have two sets of data: x - c(7, 7 , 8, 9, 15, 17, 18) y - c(7, 8, 9, 15, 17, 19, 20, 20, 25, 23, 22) I have used

[R] Bandwidth selection for ksmooth( )

2005-12-07 Thread Amir Safari
Dear R Users, Before running ksmooth( ), a suitable bandwidth selection is needed. I use some functions for this task and receive these results for my data: width.SJ(y,nb=100,method=ste) : 40.25 bcv(y,nb=100) : 40.53 ucv(y): 41.26 bandwidth.nrd(y) : 45.43 After

[R] Constructing a transition matrix

2005-12-07 Thread Hans Gardfjell
If you order your factor levels in your vectors in the order you want in the output, then the prop.table(prop()) command will give you what you want. But you have to reorder the factor levels so that the levels commands give the following output: levels(trans$class) [1] seed veg repr

Re: [R] summary[[r.squared]] gives strange results

2005-12-07 Thread Sundar Dorai-Raj
Felix Flory wrote: I am simulating an ANOVA model and get a strange behavior from the summary function. To be more specific: please run the following code and see for yourself: the summary()[[r.squared]] values of two identical models are quite different!! ## 3 x 3 ANOVA of two factors x

Re: [R] heatmap aspect ratio

2005-12-07 Thread Gregoire Thomas
You can change the code of layout: layout(lmat, widths = lwid, heights = lhei, respect = TRUE) layout(lmat, widths = lwid, heights = lhei, respect = FALSE) (best to create a new function my.layout with the modified code) Jacob Michaelson wrote: Hi all, Does anyone know of a fairly easy way

[R] Dots argument in apply method

2005-12-07 Thread Christophe Pouzat
Hello everyone, I'm working on a package using S4 classes and methods and I ran into the following problem when I tried to create an apply method for objects of one of my new classes. I've found a way around the problem but I wonder if I did not paint myself into the corner. I'd like your

Re: [R] Plot

2005-12-07 Thread Marc Schwartz
On Wed, 2005-12-07 at 18:08 +1100, paul sorenson wrote: Apple Ho wrote: Hello, I have a problem about using the command plot. Suppose I have some points, and one of them is (0,0), how can I show the figure with this point which is at the corner? How close to the corner do you want

Re: [R] ploting the two sets of data side by side

2005-12-07 Thread Gabor Grothendieck
Or building on that solution but eliminating the do.call and lapply: f - function(x) table(cut(x, breaks = seq(0, 30, 5))) barplot(rbind(f(x), f(y)), beside = TRUE) On 12/7/05, Jacques VESLOT [EMAIL PROTECTED] wrote: try : barplot(do.call(rbind,lapply(list(x,y), function(x) table(cut(x,

Re: [R] Dots argument in apply method

2005-12-07 Thread Prof Brian Ripley
Why does simply setMethod(apply, signature(X = myClass, MARGIN = numeric, FUN = function), function(X, MARGIN, FUN, ...) .apply.myClass(X, MARGIN, FUN, ...)) not do what you want? It works for me in your example, e.g.

Re: [R] Matrix of dummy variables from a factor

2005-12-07 Thread Andrew Robinson
Bert, how about when making predictions of contrasts using, for example, estimable() from the gmodels package? I find it very useful. Andrew -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Berton Gunter Sent: Wednesday, 7 December 2005 8:27 AM

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Jim Lemon
Adaikalavan Ramasamy wrote: Yes, it drives me mad too when people use = instead of - for assignment and suppress spaces in an naive attempt for saving space. In fact, I like the - assignment operator, but tend to write code densely myself as that is the way I like to view it. As R formats

Re: [R] lmer and glmmPQL

2005-12-07 Thread Douglas Bates
On 12/5/05, Cox, Stephen [EMAIL PROTECTED] wrote: I have been looking into both of these approaches to conducting a GLMM, and want to make sure I understand model specification in each. In particular - after looking at Bates' Rnews article and searching through the help archives, I am unclear

[R] How to simplify

2005-12-07 Thread Rhett Eckstein
Dear list, I have a list containing parameters (time and X1), and have n similar data set like the following: cal [[1]] timeX1 1 0.0 10.006306 2 0.5 9.433443 3 1.0 8.893405 4 2.0 7.904274 5 4.0 6.243807 6 6.0 4.932158 7 8.0 3.896049 8 10.0 3.077604 [[2]] timeX1

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread P Ehlers
Oh Patrick, surely German Capitalization is better! :) Peter Patrick Connolly wrote: On Tue, 06-Dec-2005 at 04:21PM +, Patrick Burns wrote: | I don't put in extraneous ';' because I maybe get a | blister on my little finger. | | I suspect that those who find the semi-colons ugly in

Re: [R] ploting the two sets of data side by side

2005-12-07 Thread P Ehlers
As usual, Gabor provides an elegant solution. But I hope that, in this case, the OP provided a toy example. Otherwise, I don't see the point of applying cut() to a vector of length 7. Why not just use stripchart()? Peter Ehlers Gabor Grothendieck wrote: Or building on that solution but

Re: [R] Dots argument in apply method

2005-12-07 Thread Christophe Pouzat
Dear Prof. Ripley, Thanks for the clarification. Prof Brian Ripley wrote: Why does simply setMethod(apply, signature(X = myClass, MARGIN = numeric, FUN = function), function(X, MARGIN, FUN, ...) .apply.myClass(X, MARGIN, FUN,

Re: [R] How to simplify

2005-12-07 Thread Gabor Grothendieck
I suggest that when displaying test data in a post that you do it like this: dput(cal) since then others can simply copy and paste it into their session. At any rate, using this test data: cal - list(A = data.frame(time = 1:3, X1 = 1:3), B = data.frame(1:3, X1 = 3:5)) Pick off the

Re: [R] How to simplify

2005-12-07 Thread Dimitris Rizopoulos
assuming that you have the same number of measurements in each sub-data.frame, you could use something like: cal - lapply(1:10, function(x) data.frame(time = c(0, 0.5, 1, 2, 4, 6, 8, 10), X1 = rnorm(8, 10:3))) ## rowMeans(as.data.frame(lapply(cal, [, X1))) I hope it helps. Best,

Re: [R] lmer and glmmPQL

2005-12-07 Thread Cox, Stephen
Thanks for the reply Doug! A follow up question and comment ... 1) If I understand correctly, looking at a simple situation in which SITES are nested in ZONES, the following should be similar. However, despite the same F values, the p-value from lmer is 1/2 the other methods. Why is this true?

[R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Jan Verbesselt
Hi all, How can the label of the x-axes in the plot() of a stl.object be adapted? e.g., When plotting: plot(stl(nottem, per)) In the labels of the x-axes is “time”. How can this be changed to e.g., “Time (dekade) “? It does not work with xlab or others anymore… Thanks, Jan

Re: [R] How to simplify

2005-12-07 Thread Petr Pikal
Hi changing list to matrix and making summary could do the trick lll - list(a=cbind(1:10, rnorm(10)), b=cbind(1:10, rnorm(10))) mat - do.call(rbind, lll) tapply(mat[,2], mat[,1], mean) BTW I found a suitable thread with similar question in CRAN search list summary mean HTH Petr On 7 Dec

Re: [R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Gabor Grothendieck
If you look through the output of: stats:::plot.stl you see right near the end that time is hard coded in the call to mtext. However, we could temporarily redefine mtext so that it works as you wish and then redefine plot.stl so that it looks within the environment of our function to find mtext

Re: [R] Closed form for regression splines - solution

2005-12-07 Thread Stephen A Roberts
Greetings, The question was about getting closed form equations from a bs() representation of a curve so enabling publication of a fitted curve for uise outside R. In case anyone else is interested, the solution lies in exploiting the fact that we can get accurate derivatives at the

[R] A question on colors for plotog groupedData

2005-12-07 Thread Albert Sorribas
I have a groupedData object named data. When I use plot(data) I obtain a trellis plot for each group with a grey bakground. How can I change the background to white? I tried with par(bg=white) but got no change at all. I would appreciate any suggestion. -- Albert Sorribas Grup de

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Dave Roberts
Well, this has been an interesting thread. I guess my own perspective is warped, having never been a C programmer. My native languages are FORTRAN, python, and R, all of which accept (or demand) a linefeed as a terminator, rather than a semicolon, and two of which are very particular about

Re: [R] A question on colors for plotog groupedData

2005-12-07 Thread Deepayan Sarkar
On 12/7/05, Albert Sorribas [EMAIL PROTECTED] wrote: I have a groupedData object named data. When I use plot(data) I obtain a trellis plot for each group with a grey bakground. How can I change the background to white? I tried with par(bg=white) but got no change at all. I would appreciate

Re: [R] Time series influenced by half-time, intake and treatment...

2005-12-07 Thread Spencer Graves
Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? The latter part about nonlinear modeling with mixed effects sounds like it could help you a lot. 1. Consistent with that, I might start by averaging over all 15 people, then making

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Gabor Grothendieck
On 12/7/05, Dave Roberts [EMAIL PROTECTED] wrote: Well, this has been an interesting thread. I guess my own perspective is warped, having never been a C programmer. My native languages are FORTRAN, python, and R, all of which accept (or demand) a linefeed as a terminator, rather than a

[R] organizing plot drawing routines; creating complex expressions

2005-12-07 Thread Steven Lacey
Hi, My general goal is to find a coding strategy to efficiently store and retrieve drawing routines for different plots. This is my approach so far. In a single text file I store multiple drawing routines where each routine draws a different plot. A drawing routine may look like this:

Re: [R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Jan Verbesselt
Thanks a lot! However, it’s not working perfectly yet. The function plot.stl now also changes the labels of Data, Seasonal, Trend, and Remainder to the text defined for “xlab”. How could this be fine-tuned? Regards, Jan -Original Message- From: Gabor Grothendieck [mailto:[EMAIL

Re: [R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Gabor Grothendieck
One other thought. This can be arguably done more compactly using the proto package. We define a proto object consisting of three components: - plot.stl which is just a copy of the corresponding routine in the stats package, - our redefined mtext and - our desired x label. and then run

[R] R programming job in Boston

2005-12-07 Thread Oliver A. Will
Hello, I'm a senior statistician at Affinnova, a market research firm outside of Boston, MA. We are looking to hire a strong R programmer. Here is the description of the job: Come join a growing company in the market innovation field. Affinnova is changing innovation and product development by

Re: [R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Gabor Grothendieck
This should fix that problem: plot.stl - function(..., xlab = time) { mtext - function(text, ...) graphics::mtext(if (text == time) xlab else text, ...) plot.stl - stats:::plot.stl environment(plot.stl) - environment() plot.stl(...) } Also for

[R] concatenate data frame

2005-12-07 Thread [EMAIL PROTECTED]
hi all Here is a small part of my code: tab_tmp-tab[1:(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])),length(tab)]; tab_tmp1-tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),length(tab)]; tab-c(tab_tmp,tab_tmp1); attach(tab); Here is the

[R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Kurt Wollenberg
Greetings all: OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is simple and straightforward but for the life of me I cannot find it in the documentation, in the archives, or in my notes (because I know I've encountered this in the past). My problem is: I have a data

[R] ttda on R 2.1.1: error

2005-12-07 Thread Lucie RYBARCZYK
Do you know where I can download R 2.1.0 ?? I would like to use ttda. Thanks Lucie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Constructing a transition matrix

2005-12-07 Thread Chris Stubben
Hi Peter, Thanks for pointing out the set functions. I can use setdiff to find missing rows setdiff(dev, rownames(A)) [1] seed and intersect to find common rows d1- intersect(dev, rownames(A) ) [1] veg rep I was trying to use a negative index like A[-1,] to remove the dead row, but d1 is a

Re: [R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Kevin E. Thorpe
Does newDF - oldDF[,c(A,C,D)] work? Kurt Wollenberg wrote: Greetings all: OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is simple and straightforward but for the life of me I cannot find it in the documentation, in the archives, or in my notes (because I know I've

Re: [R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Ferdinand Alimadhi
newDF - oldDF[,c(A,C,D)] HTH Kurt Wollenberg wrote: Greetings all: OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is simple and straightforward but for the life of me I cannot find it in the documentation, in the archives, or in my notes (because I know I've

Re: [R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Tobias Verbeke
Kurt Wollenberg wrote: Greetings all: OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is simple and straightforward but for the life of me I cannot find it in the documentation, in the archives, or in my notes (because I know I've encountered this in the past). My

Re: [R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Roger Bivand
On Wed, 7 Dec 2005, Kurt Wollenberg wrote: Greetings all: OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is simple and straightforward but for the life of me I cannot find it in the documentation, in the archives, or in my notes (because I know I've encountered

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Jan T. Kim
On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote: I don't put in extraneous ';' because I maybe get a blister on my little finger. I suspect that those who find the semi-colons ugly in R do not find them ugly in C. I think the reason there would be a visceral reaction in R

[R] Are minbucket and minsplit rpart options working as expected?

2005-12-07 Thread Carlos J. Gil Bellosta
Dear r-list: I am using rpart to build a tree on a dataset. First I obtain a perhaps too large tree: arbol.bsvg.02 - rpart(formula, data = bsvg, subset=grp.entr, control=rpart.control(cp=0.001)) arbol.bsvg.02 n= 10 node), split, n, loss, yval, (yprob) * denotes terminal node 1)

Re: [R] concatenate data frame

2005-12-07 Thread P Ehlers
Guillaume, I assume that 'tab' is a data frame and that, for some unspecified reason, you want to get two subsets of the last column of tab, overlapping one case, and coercing the final result to a data frame. If that is correct, then as.data.frame(c(tab_tmp, tab_tmp1)) will give you a data

[R] KMO sampling adequacy and SPSS -- partial solution

2005-12-07 Thread Ashish Ranpura
Dear colleagues, I've been searching for information on the Kaiser-Meyer-Olkin (KMO) Measure of Sampling Adequacy (MSA). This statistic is generated in SPSS and is often used to determine if a dataset is appropriate for factor analysis -- it's true utility seems quite low, but it seems to

Re: [R] KMO sampling adequacy and SPSS -- partial solution

2005-12-07 Thread Ashish Ranpura
Sorry, there was an error in that function, a hangover from a previous session. The corrected function is: kmo.test - function(df){ ### ## Calculate the Kaiser-Meyer-Olkin Measure of Sampling Adequacy. ## Input should be a data frame or matrix, output is the KMO statistic. ## Formula derived

Re: [R] ttda on R 2.1.1: error

2005-12-07 Thread Peter Dalgaard
Lucie RYBARCZYK [EMAIL PROTECTED] writes: Do you know where I can download R 2.1.0 ?? I would like to use ttda. Which platform? Both source and Windows binaries of historic releases are on CRAN and are not particularly hard to find. Any particular reason why this cannot work with R-2.2.0

[R] contrasts for lm

2005-12-07 Thread Ann Hess
I would like estimate a number of contrasts from a one-way ANOVA model. I see that the lm command has a contrasts option, but I can't figure out how to use it! Any help that can be offered would be greatly apreciated. Here is my model statement: Model-lm(log2PM~P+T+P*T) where P has 16

[R] error message from building R in Mac

2005-12-07 Thread Fang-Yi Chiou
Following the instruction in R website and downloading gcc and g77, I am trying to configure and build R in my Mac laptop, but got some error message that I do not know how to resolve. Do any of you know how to solve this problem? After type ./configure, I got the following message. R is

Re: [R] Change labels of x-axes in Plot of stl() function?

2005-12-07 Thread Gabor Grothendieck
I noticed that we can combine the function and proto approaches by placing the proto in the function with these advantages: 1. the function body can be reduced to just two statements 2. no explicit manipulation of environments via environment(...) is required (as proto does that itself

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Deepayan Sarkar
On 12/7/05, Jan T. Kim [EMAIL PROTECTED] wrote: On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote: I don't put in extraneous ';' because I maybe get a blister on my little finger. I suspect that those who find the semi-colons ugly in R do not find them ugly in C. I think

[R] mle.stepwise versus step/stepAIC

2005-12-07 Thread Jim Brindle
Hello, I have a question pertaining to the stepwise regression which I am trying to perform. I have a data set in which I have 14 predictor variables accompanying my response variable. I am not sure what the difference is between the function mle.stepwise found in the wle package and the

Re: [R] Ancova and lme use

2005-12-07 Thread Spencer Graves
Mon cher M. MENICACCI: It looks to me like you ultimately want to use lmer in library(lme4) [which also requires library(Matrix)]. For documentation, I suggest you start with Doug Bates (2005) Fitting Linear Mixed Models in R, R News, vol. 5/1: 27-30 (available from

Re: [R] Tidal Time Series Analysis in R

2005-12-07 Thread Spencer Graves
I haven't seen any replies, so I will offer a few thoughts: If this were my problem, I'd start using lm with terms that predict the tide in terms of the positions of the sun and moon. If other things were thought to be important, I'd include them also in the lm model.

[R] Accounting for within family correlation in genetic analysis

2005-12-07 Thread John Sorkin
I am hoping for help with a genetic analysis. I am trying to perform an analysis of the relation between genes at a given locus (rs2304795) and a phenotypic trait (zerotg). Multiple subjects are recruited from each family (and so share a part of their genome and are correlated). Family groups

[R] read.table error

2005-12-07 Thread Eric C. Jennings
Hey, Once again I ask for some quick help. Here is some code: ovendata- read.table(ovens.dat,header=TRUE) attach(ovendata) print(ovendata) Here is the .dat file: DOne Two Three FourFiveSeven Eight 1130254 252 375 384 252 375 876 127 250

Re: [R] Warnings about user error (was read.table error)

2005-12-07 Thread Prof Brian Ripley
I see no error here, let alone an error in read.table as claimed in your subject line. The posting guide does specifically ask `Use an informative subject line'. Please distinguish warnings about _your_ usage from errors in R. The first warning is that R fixed up an error in your file: it is

Re: [R] mle.stepwise versus step/stepAIC

2005-12-07 Thread Prof Brian Ripley
You could ask the author of the contributed package 'wle', which is not part of the `R-software'. The documentation is minimal, but the references are all to classical stepwise methods such as those in package leaps, that is they select columns in the model matrix and _not_ terms. On Wed, 7

Re: [R] R is GNU S, not C.... [was how to get or store .....]

2005-12-07 Thread Martin Maechler
DeepS == Deepayan Sarkar [EMAIL PROTECTED] on Wed, 7 Dec 2005 19:15:52 -0600 writes: DeepS On 12/7/05, Jan T. Kim [EMAIL PROTECTED] wrote: On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote: I don't put in extraneous ';' because I maybe get a blister on my