Re: [R] biplot label size

2006-09-06 Thread Prof Brian Ripley
cex works for me. On Tue, 5 Sep 2006, Nair, Murlidharan T wrote: Which is the parameter that is used to decrease the size of ylabs plotted in biplot? I tried playing with cex and cex.lab I am not getting it right pc - princomp(USArrests) biplot(pc, xlabs = rep(,

[R] Question on AffyBatch

2006-09-06 Thread Gunther Höning
Dear list, I'm trying to find out the following in an AffyBatch. To get the indices from a loction on a chip I use the function xy2i() for the hgu133plus2 by Affymetrix. But now I want to know the name of the probe located at this spot. How can this be done? And what about the locations used as

Re: [R] Quick question about lm()

2006-09-06 Thread Tong Wang
Thanks a lot for your help. tong - Original Message - From: Christos Hatzis [EMAIL PROTECTED] Date: Monday, September 4, 2006 10:54 pm Subject: RE: [R] Quick question about lm() To: 'Tong Wang' [EMAIL PROTECTED], r-help@stat.math.ethz.ch Say, my.lm - lm(y ~ x, data=my.data) Then

Re: [R] A question about gc()

2006-09-06 Thread Tong Wang
Yes, I am using R in windows, sorry for not being specific. You are right, I have stored too much stuff, and I need to trash some data in the process. Problem solved for me, Thank you very much. tong - Original Message - From: Prof Brian Ripley [EMAIL PROTECTED] Date: Tuesday,

[R] What is the matrix version of min()

2006-09-06 Thread Tong Wang
Hi, Is there a function which operates on a matrix and return a vector of min/max of each rol/col ? say, X= 2, 1 3, 4 min.col(X)=c(2,1) thanks a lot. tong __ R-help@stat.math.ethz.ch mailing list

Re: [R] Fitting generalized additive models with constraints?

2006-09-06 Thread Simon Wood
On Tuesday 05 September 2006 20:32, David Reiss wrote: I am trying to fit a GAM for a simple model, a simple model, y ~ s(x0) + s(x1) ; with a constraint that the fitted smooth functions s(x0) and s(x1) have to each always be 0. From the library documentation and a search of the R-site

Re: [R] What is the matrix version of min()

2006-09-06 Thread Robin Hankin
Tong you need to use apply(). The second argument specifies whether you want to work with rows or columns. The point of this is that min() and max() operate on vectors and give a single value, and you want to apply this function to all rows or all columns: a - matrix(rnorm(30),5,6)

Re: [R] What is the matrix version of min()

2006-09-06 Thread Dimitris Rizopoulos
you could use something like: # for row min and max apply(X, 1, min) apply(X, 1, max) # for column min and max apply(X, 2, min) apply(X, 2, max) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven

Re: [R] What is the matrix version of min()

2006-09-06 Thread mel
Tong Wang a écrit : Hi, Is there a function which operates on a matrix and return a vector of min/max of each rol/col ? say, X= 2, 1 3, 4 min.col(X)=c(2,1) thanks a lot. tong see ?pmin, which.min, which.max, max.col hih

[R] [R-pkgs] package ltm -- version 0.6-0

2006-09-06 Thread Dimitris Rizopoulos
Dear R-users, I'd like to announce the release of the new version of package 'ltm' for analyzing multivariate dichotomous and polytomous data under the Item Response Theory approach. New features: * function tpm() (along with supporting methods, i.e., anova, plot, margins, factor.scores,

Re: [R] What is the matrix version of min()

2006-09-06 Thread JeeBee
see ?apply min.row - apply(X, 1, min) min.col - apply(X, 2, min) JeeBee On Wed, 06 Sep 2006 01:37:22 -0700, Tong Wang wrote: Hi, Is there a function which operates on a matrix and return a vector of min/max of each rol/col ? say, X= 2, 1 3, 4

Re: [R] What is the matrix version of min()

2006-09-06 Thread David Scott
On Wed, 6 Sep 2006, Robin Hankin wrote: Tong you need to use apply(). The second argument specifies whether you want to work with rows or columns. The point of this is that min() and max() operate on vectors and give a single value, and you want to apply this function to all rows or all

Re: [R] What is the matrix version of min()

2006-09-06 Thread Tong Wang
Hi, THANK YOU ALL for the prompt reply. cheers. - Original Message - From: Robin Hankin [EMAIL PROTECTED] Date: Wednesday, September 6, 2006 1:42 am Subject: Re: [R] What is the matrix version of min() To: Tong Wang [EMAIL PROTECTED] Cc: R help r-help@stat.math.ethz.ch Tong you

[R] plot axises on both sides of a graph

2006-09-06 Thread gallon li
Usually the y-axis is shown on the left-hand-side of a graph, is it possible to artifically creat one more y-axis on the right-hand-side in R? What is the main reference? Thank you in advance. [[alternative HTML version deleted]] __

[R] histogram in the background?

2006-09-06 Thread gallon li
I intend to draw a plot of y against x. In the background of this graph I wish to creat a histogram of the horizontal variable x. Does any expert know how to produce such a plot? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch

Re: [R] winDialog UNIX equivalent?

2006-09-06 Thread JeeBee
Yes, there are many. To give one example, you could consider using tcltk. library(tcltk) tkmessageBox(title=This is terrible, message=What did you do?\nPromise not to do this again!, icon=error, type=ok) On Tue, 05 Sep 2006 23:10:41 +0200, Richard Müller wrote: Hi all,

Re: [R] histogram in the background?

2006-09-06 Thread JeeBee
How about this? http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78 JeeBee On Wed, 06 Sep 2006 18:19:28 +0800, gallon li wrote: I intend to draw a plot of y against x. In the background of this graph I wish to creat a histogram of the horizontal variable x. Does any expert

Re: [R] plot axises on both sides of a graph

2006-09-06 Thread JeeBee
Look at: ?axis (try the examples) Further, a nice example I found on this mailing lists archive, from somebody who says this has been asked many times already :) x - 1:10 y1 - 1:10 y2 - rev(seq(1,1000, length=10)) plot(x,y1,ann=FALSE) axis(2, at=c(2,4,6,8), labels=as.character(c(2,4,6,8)))

Re: [R] histogram in the background?

2006-09-06 Thread JeeBee
gallon li wrote: I have found this one before. However, my intension is slightly differing from this plot: I wish to plot the histogram in the backgroun instead of in the margin. Thanks anyway! On Wed, 06 Sep 2006 12:29:51 +0200, JeeBee wrote: How about this?

[R] Fwd: plot axises on both sides of a graph

2006-09-06 Thread gallon li
-- Forwarded message -- From: gallon li [EMAIL PROTECTED] Date: Sep 6, 2006 7:48 PM Subject: Re: [R] plot axises on both sides of a graph To: Jim Lemon [EMAIL PROTECTED] Both of your suggestions are so helpful. By combining what you told me, now I am able to produce a second

Re: [R] winDialog UNIX equivalent?

2006-09-06 Thread Richard Müller
I'm using winDialog and winDialogString in scripts running on a XP-machine. Since we're using some Linux-machines (Suse 10.0 and 10.1 on x86) I'm Thanks to the respondents. Use of TCl/Tk is a fine idea, because you can use the same scripts on Win and Linux OS. Richard -- Richard Müller - Am

[R] problem with putting objects in list

2006-09-06 Thread Rainer M Krug
Hi I use the following code and it stores the results of density() in the list dr: dens - function(run) { density( positions$X[positions$run==run], bw=3, cut=-2 ) } dr - lapply(1:5, dens) but the results are stored in dr[[i]] and not dr[i], i.e. plot(dr[[1]]) works, but plot([1]) doesn't. Is

Re: [R] Fwd: plot axises on both sides of a graph

2006-09-06 Thread JeeBee
See these two examples. plot(1:2) axis(4) mtext(right y axis, side=4, line=-1.5) par(mar=c(5,4,4,5)+.1) plot(1:2) axis(4) mtext(right y axis, side=4, line=3) Good luck finding the right combination again ;) On Wed, 06 Sep 2006 20:08:43 +0800, gallon li wrote: -- Forwarded message

Re: [R] histogram in the background?

2006-09-06 Thread John Kane
--- JeeBee [EMAIL PROTECTED] wrote: gallon li wrote: I have found this one before. However, my intension is slightly differing from this plot: I wish to plot the histogram in the backgroun instead of in the margin. Thanks anyway! On Wed, 06 Sep 2006 12:29:51 +0200, JeeBee wrote:

Re: [R] Question on AffyBatch

2006-09-06 Thread James W. MacDonald
Hi Gunther, Gunther Höning wrote: Dear list, I'm trying to find out the following in an AffyBatch. This question is related specifically to a Bioconductor package, so should be asked on the bioconductor listserv rather than R-help. Best, Jim To get the indices from a loction on a

Re: [R] histogram in the background?

2006-09-06 Thread hadley wickham
I intend to draw a plot of y against x. In the background of this graph I wish to creat a histogram of the horizontal variable x. Does any expert know how to produce such a plot? When constructing such a plot, you need to be careful that you don't end up constructing a pretty picture instead

Re: [R] problem with putting objects in list

2006-09-06 Thread Antonio, Fabio Di Narzo
Use 'sapply' instead of 'lapply'. Type ?lapply for details Antonio, Fabio Di Narzo. University of Bologna, Italy 2006/9/6, Rainer M Krug [EMAIL PROTECTED]: Hi I use the following code and it stores the results of density() in the list dr: dens - function(run) { density(

Re: [R] problem with putting objects in list

2006-09-06 Thread Rainer M Krug
Antonio, Fabio Di Narzo wrote: Use 'sapply' instead of 'lapply'. Type If I use sapply it seems to simplify / collapse to much. ?lapply for details Antonio, Fabio Di Narzo. University of Bologna, Italy 2006/9/6, Rainer M Krug [EMAIL PROTECTED]: Hi I use the following code and it

[R] how to loop through 2 lists with different indexes

2006-09-06 Thread Tania Oh
Dear all, I am a newbie in R and need some help please. (I do apologise if my email is not as informative as it should be, I've tried to include the relevant details without overcrowding it with the rest of the code) I would like to sample (without replacement) Y objects based on the

[R] how to loop through 2 lists with different indexes

2006-09-06 Thread Tania Oh
Very sorry if this mail is sent out twice to the list, I wasn't sure if the email address I used in the first go was correct. From: [EMAIL PROTECTED] Subject:how to loop through 2 lists with different indexes Date: 6 September 2006 15:16:21 BDT

Re: [R] how to loop through 2 lists with different indexes

2006-09-06 Thread jim holtman
To find what names are common to both, use 'intersect' x.bin.size - list('3'=1, '4'=4, '5'=10) y.bin.size - list('2'=4, '3'=42, '4'=253, '5'=954) sameNames - intersect(names(x.bin.size), names(y.bin.size)) sameNames [1] 3 4 5 lapply(sameNames, function(x) sample(seq(y.bin.size[[x]]),

[R] About the Skew Student distribution

2006-09-06 Thread pierre clauss
Hello everybody, I need your help about the package SN and the skew student distribution. Il will be very grateful if I have the solution. I construct a stochastic model with a white noise not gaussian but following a skew student distribution. I fit the noise on monthly data to obtain the

[R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread toby_marks
I am trying to divide the columns of a matrix by the first row in the matrix. I have tried to get this using apply and I seem to be missing a concept regarding the apply w/o calling a function but rather command args %*% / etc. Would using apply be more efficient than this approach? I have

[R] density plots????

2006-09-06 Thread Luis Barreiro
Dear all, I arrive to do density plots using the function kde2d , and from this do a countour plot. My problem is that I do not really understand what the labels for the different levels mean??? What I would like to obtain is a surface encompassing the 95 percentile of my values. In other

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Christos Hatzis
See ?sweep sweep(a, 2, a[1,],/) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, September 06, 2006 11:49 AM To: r-help@stat.math.ethz.ch Subject: [R] Matrix multiplication using apply() or lappy() ? I am

[R] Covariance/Correlation matrix for repeated measures data frame

2006-09-06 Thread Afshartous, David
All, I have a repeated measures data frame and was wondering if the covariance matrix can be calculated via some created indexing or built-in R function. Specifically, say there are 3 variables, where potassium concentration is measured 6 times on each patient. Patient number (discrete) Time

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Gabor Grothendieck
Here are a few possibilities: a - matrix(1:24, 4) # test data a / rep(a[1,], each = 4) a / outer(rep(1, nrow(a)), a[1,]) a %*% diag(1/a[1,]) sweep(a, 2, a[1,], /) On 9/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am trying to divide the columns of a matrix by the first row in the

Re: [R] Covariance/Correlation matrix for repeated measures data frame

2006-09-06 Thread Dimitris Rizopoulos
try the following: dat - data.frame(id = rep(1:100, each = 6), time = rep(1:6, 100), pot = rnorm(600)) # for a balanced data-set mat - matrix(dat$pot, ncol = 6, byrow = TRUE) cor(mat) # for a unbalanced data-set dat - dat[-sample(600, 100), ] mat - t(sapply(split(dat, dat$id), function(x){

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Gabor Grothendieck
And here is one more: t(apply(a, 1, function(x) x/a[1,])) On 9/6/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here are a few possibilities: a - matrix(1:24, 4) # test data a / rep(a[1,], each = 4) a / outer(rep(1, nrow(a)), a[1,]) a %*% diag(1/a[1,]) sweep(a, 2, a[1,], /) On

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Prof Brian Ripley
On Wed, 6 Sep 2006, Christos Hatzis wrote: See ?sweep sweep(a, 2, a[1,],/) That is less efficient than a/rep(a[1,], each=nrow(a)) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, September

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Gabor Grothendieck
This last one could also be written slightly shorter as: t(apply(a, 1, /, a[1,])) On 9/6/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: And here is one more: t(apply(a, 1, function(x) x/a[1,])) On 9/6/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here are a few possibilities: a -

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Gabor Grothendieck
Yet another one using the idempotent apply in reshape package that eliminates the transpose: library(reshape) iapply(a, 1, /, a[1,]) On 9/6/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: This last one could also be written slightly shorter as: t(apply(a, 1, /, a[1,])) On 9/6/06, Gabor

[R] Help on estimated variance in lme4

2006-09-06 Thread jerome lemaitre
Dear all, I get an error message when I run my model and I am not sure what to do about it. I try to determine what factors influence the survival of voles. I use a mixed-model because I have several voles per site (varying from 2 to 19 voles). Here is the model: ### fm5 -lmer(data=cdrgsaou2,

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Rolf Turner
Prof. Brian Ripley wrote: On Wed, 6 Sep 2006, Christos Hatzis wrote: See ?sweep sweep(a, 2, a[1,],/) That is less efficient than a/rep(a[1,], each=nrow(a)) *My* first instinct was to use t(t(a)/a[1,]) (which has not heretofore been suggested). This seems to be more

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread toby_marks
The apply was exactly what I was after. And, I will check out the others as well. great tips! Gabor Grothendieck [EMAIL PROTECTED] 09/06/2006 11:11 AM To [EMAIL PROTECTED] [EMAIL PROTECTED] cc r-help@stat.math.ethz.ch Subject Re: [R] Matrix multiplication using apply() or lappy() ?

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Gabor Grothendieck
In terms of speed Toby's original idea was actually the fastest. Here they are decreasing order of the largest timing in each row of system.time. I also tried it with a 100x10 matrix and got almost the same order: library(reshape) system.time(for(i in 1:1000) iapply(a, 1, /, a[1,])) [1] 11.51

Re: [R] Matrix multiplication using apply() or lappy() ?

2006-09-06 Thread Prof Brian Ripley
What version of R was this? In 2.4.0 alpha a - matrix(1:24,4) system.time(for(i in 1:1000) junk - a / rep(a[1,], each = 4)) [1] 0.014 0.000 0.014 0.000 0.000 system.time(for(i in 1:1000) junk - t(t(a)/a[1,])) [1] 0.057 0.000 0.058 0.000 0.000 shows a large margin the other way, which

[R] singular factor analysis

2006-09-06 Thread Spencer Graves
Are there any functions available to do a factor analysis with fewer observations than variables? As long as you have more than 3 observations, my computations suggest you have enough data to estimate a factor analysis covariance matrix, even though the sample covariance matrix is

Re: [R] problem with putting objects in list

2006-09-06 Thread Tony Plate
I suspect you are not thinking about the list and the subsetting/extraction operators in the right way. A list contains a number of components. To get a subset of the list, use the '[' operator. The subset can contain zero or more components of the list, and it is a list itself. So, if x is

[R] deleting an arow added to a graphic

2006-09-06 Thread Graham Smith
I know this has got to be simple, but I have a added an arrow to a graph with: arrows(5,8,8, predict(lmfit,data.frame(x=8)), length=0.1) but its in the wrong position, correcting it and running again adds an new arrow (which is what you would expect) so how do I a) edit the existing arrow, and

Re: [R] deleting an arow added to a graphic

2006-09-06 Thread Duncan Murdoch
On 9/6/2006 3:04 PM, Graham Smith wrote: I know this has got to be simple, but I have a added an arrow to a graph with: arrows(5,8,8, predict(lmfit,data.frame(x=8)), length=0.1) but its in the wrong position, correcting it and running again adds an new arrow (which is what you would

Re: [R] deleting an arow added to a graphic

2006-09-06 Thread Gabor Grothendieck
This does not actually remove it but you could overwrite it with an arrow the same color as the background and then plot a new arrow: x - 1:10 plot(x ~ x) arrows(1, 1, 2, 2) # revise it arrows(1, 1, 2, 2, col = white) arrows(2, 2, 3, 3) On 9/6/06, Graham Smith [EMAIL PROTECTED] wrote: I know

Re: [R] continuation lines in R script files

2006-09-06 Thread Mike Meyer
I literally copy/pasted your second version (without the + signs) in a file and the sourced that file. It loaded without error and the a matrix was as I expected. On 9/6/06, Evan Cooch [EMAIL PROTECTED] wrote: When I have to enter a very large matrix into the R console, I can make use of the

Re: [R] continuation lines in R script files

2006-09-06 Thread Joris De Wolf
Are your sure your second solution does not work? Try again... Evan Cooch wrote: When I have to enter a very large matrix into the R console, I can make use of the continuation feature in the console to enter the matrix in pieces (e.g., on a row by row basis). So, for example, the console

Re: [R] About the Skew Student distribution

2006-09-06 Thread Ben Bolker
pierre clauss pierreclauss at yahoo.fr writes: Hello everybody, I need your help about the package SN and the skew student distribution. Il will be very grateful if I have the solution. I construct a stochastic model with a white noise not gaussian but following a skew student

[R] How to get multiple partial matches?

2006-09-06 Thread Sarah Tucker
Hi, I'm very new to R, and am not at all a software programmer of any sort.I appreciate any help you may have. I have figured out how to get my data into a dataframe and order it alphabetically according to a particular column. Now, I would like to seperate out certain rows based on

Re: [R] How to get multiple partial matches?

2006-09-06 Thread jim holtman
Try using 'grep' and regular expressions: x - 72 5S_F_1501 567 + 7700 5S_F_2338 611 + 7517 5S_F_3412 467 + 10687 5S_F_4380 428 + 4870 5S_F_5315 368 + 6035 5S_F_6300

Re: [R] Help on estimated variance in lme4

2006-09-06 Thread Douglas Bates
Could you try this model fit again adding control = list(usePQL = FALSE, msVerbose=TRUE) to the argument list of the call to lmer? By default PQL iterations are used at the beginning of a generalized linear mixed model fit followed by optimization of the Laplace approximation to the

Re: [R] Problem with Variance Components (and general glmm confusion)

2006-09-06 Thread Douglas Bates
On 9/4/06, Toby Gardner [EMAIL PROTECTED] wrote: Dear list, I am having some problems with extracting Variance Components from a random-effects model: I am running a simple random-effects model using lme: model-lme(y~1,random=~1|groupA/groupB) which returns the output for the StdDev of

[R] graphics - joining repeated measures with a line

2006-09-06 Thread Murray Pung
I would like to join repeated measures for patients across two visits using a line. The program below uses symbols to represent each patient. Basically, I would like to join each pair of symbols. library(lattice) patient - c(1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9) var -

Re: [R] graphics - joining repeated measures with a line

2006-09-06 Thread Gabor Grothendieck
Make each pair of points a separate group using group= and specify that both points and lines be used via type = b. Also set the symbols in par.settings= so that they are accessed by both the main plot and the legend: xyplot(var ~ visit, group = symbols[patient], type = b, auto.key =

Re: [R] graphics - joining repeated measures with a line

2006-09-06 Thread Gabor Grothendieck
Just one correction (although in this case it does not change the output) -- use group = patient rather than group = symbol[patient]: xyplot(var ~ visit, group = patient, type = b, auto.key = list(space = right), par.settings = list(superpose.symbol = list(pch = symbols))) On 9/6/06, Gabor

[R] stratified poisson regression

2006-09-06 Thread Hannah Murdoch
Hello, I'm fitting poisson regression to mortality data and wish to stratify by age. Is there any way to perform this stratification and use the glm function in R? Thanks, Hannah Murdoch __ R-help@stat.math.ethz.ch mailing list