Re: [R] Using sunflowerplot to add points in a xyplot panel

2007-08-14 Thread Sundar Dorai-Raj
Ronaldo Reis Junior said the following on 8/14/2007 7:08 AM: Hi, I use panel.points to add points to a xyplot graphic. But I like to use the sunflowerplot to plot my points because this is very superimposed. It is possible to use this? I try but it dont work directly. It may be need to

Re: [R] weights in lmer

2007-08-14 Thread Sundar Dorai-Raj
Try weights = as.numeric(total) BTW, there is a SIG (Special Interest Group) for lmer. https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models HTH, --sundar Chris O'Brien said the following on 8/14/2007 11:00 AM: Dear R users, Prof. Ripley just corrected my understanding of the use of

Re: [R] setup trellis.device to color=F inside the xyplot function

2007-08-05 Thread Sundar Dorai-Raj
Ronaldo Reis Junior said the following on 8/5/2007 6:18 AM: Hi, it is possible to setup trellis.device(color=F) inside teh function xyplot? I try to use xyplot(ocup~tempo| nitro+estacao,col=white,ylim=c(0,0.7),par.settings=list(color=F)) But dont work, the only way that work for

Re: [R] Tabs in PDF documents

2007-07-30 Thread Sundar Dorai-Raj
Dennis Fisher said the following on 7/30/2007 6:25 AM: Colleagues, I am using R 2.5.1 on an Intel Mac (OS 10) to create PDF outputs using pdf(); same problem exists in Linux (RedHat 9) While adding text to the document with text() and mtext(), I encounter the following problem:

Re: [R] reversing the x-axis terms on a boxplot

2007-07-25 Thread Sundar Dorai-Raj
Dylan Beaudette said the following on 7/25/2007 11:18 AM: Hi, I am able to reverse the order of plotting on regular plots (i.e. with the plot() function) by manually setting the xlim variable. Is there some trick like this which will work for a boxplot? * for example: l -

Re: [R] Lattice: vertical barchart

2007-07-10 Thread Sundar Dorai-Raj
Michael Hoffman said the following on 7/10/2007 7:06 AM: barchart(Titanic, stack=F) produces a very nice horizontal barchart. Each panel has four groups of two bars. barchart(Titanic, stack=F, horizontal=F) doesn't produce the results I would have expected, as it produces this warning

Re: [R] How to plot two variables using a secondary Y axis

2007-07-10 Thread Sundar Dorai-Raj
Felipe Carrillo said the following on 7/10/2007 7:58 AM: Date Fo Co6/27/2007 57.1 13.96/28/2007 57.7 14.3 6/29/2007 57.8 14.36/30/2007 57 13.97/1/2007 57.1 13.9 7/2/2007 57.2 14.07/3/2007 57.3 14.17/4/2007 57.6 14.2 7/5/2007 58

Re: [R] from character string to function body?

2007-07-07 Thread Sundar Dorai-Raj
Atte Tenkanen said the following on 7/7/2007 8:41 AM: Dear R users, I wonder if it is possible to form a function from a character string. Here is an example: x=3 `-`(`+`(`^`(x,3),`^`(x,2)),1) # Here is my function evaluated. [1] 35

Re: [R] abline plots at wrong abscissae after boxplot

2007-06-21 Thread Sundar Dorai-Raj
Brian Wilfley said the following on 6/21/2007 2:44 PM: Hi folks, I'm using R 2.5.0 under ESS under Windows XP. (This also happens using the Rgui application.) I'm trying to add lines to a plot originally made with boxplot, but the lines appear in the wrong place. Below is a script that

Re: [R] ievent.wait

2007-06-13 Thread Sundar Dorai-Raj
Hi, Greg, type = 'b' won't work according to ?locator. Try type = 'o'. HTH,x --sundar Greg Snow said the following on 6/13/2007 7:27 AM: Does locator(type='l') (or type ='b') Work for you? -Original Message- From: ryestone [EMAIL PROTECTED] To:

Re: [R] logical 'or' on list of vectors

2007-06-08 Thread Sundar Dorai-Raj
Tim Bergsma said the following on 6/8/2007 5:57 AM: Suppose I have a list of logicals, such as returned by lapply: Theoph$Dose[1] - NA Theoph$Time[2] - NA Theoph$conc[3] - NA lapply(Theoph,is.na) Is there a direct way to execute logical or across all vectors? The following gives the

[R] Opening Rgui by double-clicking R script

2007-06-01 Thread Sundar Dorai-Raj
Hi, all, This is for R-2.5.0 on WinXP and in particular RGui. I'm trying to teach some colleagues of mine R and rather than impose Xemacs/ESS upon them I decided to simply start by showing them RGui. When R is installed, R workspaces (.RData) are automatically registered so that I can

Re: [R] determining a parent function name

2007-05-31 Thread Sundar Dorai-Raj
) } stop(msg) } Sundar Dorai-Raj wrote: Hi, All, I'm writing a wrapper for stop that produces a popup window using tcltk. Something like: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel

Re: [R] determining a parent function name

2007-05-31 Thread Sundar Dorai-Raj
Hi, Vladimir, Sorry, didn't see this reply. .Traceback - NULL doesn't work because of the warning in ?traceback. Warning: It is undocumented where '.Traceback' is stored nor that it is visible, and this is subject to change. Prior to R 2.4.0 it was stored in the workspace,

Re: [R] Different fonts on different axes

2007-05-31 Thread Sundar Dorai-Raj
Martin Henry H. Stevens said the following on 5/31/2007 9:59 AM: Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank

Re: [R] determining a parent function name

2007-05-31 Thread Sundar Dorai-Raj
the following on 5/31/2007 7:51 AM: Hi sundar -- maybe myerr - function(err) err$call foo - function() stop() tryCatch({ foo() }, error=myerr) foo() suggests a way to catch errors without having to change existing code or re-invent stop? Martin Sundar Dorai-Raj [EMAIL PROTECTED

Re: [R] determining a parent function name

2007-05-31 Thread Sundar Dorai-Raj
Thanks! That's the answer I was looking for. --sundar Ismail Onur Filiz said the following on 5/31/2007 12:23 PM: Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE

Re: [R] determining a parent function name

2007-05-31 Thread Sundar Dorai-Raj
Ismail Onur Filiz said the following on 5/31/2007 1:03 PM: Sorry for replying to myself, but: On Thursday 31 May 2007 12:23:12 Ismail Onur Filiz wrote: Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg

Re: [R] separate y-limits in xYplot panels

2007-05-30 Thread Sundar Dorai-Raj
Nitin Jain said the following on 5/30/2007 8:12 AM: Hello, I would like to get the scales of y-axes dependent only on the data points in a particular panel. Have attached a test example below. When using 'relation=free', it does not make the scales 'free', however when using

[R] determining a parent function name

2007-05-30 Thread Sundar Dorai-Raj
Hi, All, I'm writing a wrapper for stop that produces a popup window using tcltk. Something like: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg =

Re: [R] trouble understanding why ...==NaN isn't true

2007-05-29 Thread Sundar Dorai-Raj
Hi, Andrew, Looks like you're reading the data incorrectly. If using ?read.table or the like, try to add a na.strings = c(NA, NaN) argument. Second, Bert's comment: use ?is.nan, rather than ==. --sundar Andrew Yee said the following on 5/29/2007 3:39 PM: Okay, it turns out that there were

Re: [R] learning lattice graphics

2007-05-27 Thread Sundar Dorai-Raj
I would also suggest Paul Murrell's book R Graphics. http://www.amazon.com/Graphics-Computer-Science-Data-Analysis/dp/158488486X/ --sundar Tyler Smith said the following on 5/27/2007 1:27 PM: On 2007-05-27, Adrian Dragulescu [EMAIL PROTECTED] wrote: Check the documentation link from

Re: [R] Reducing the size of pdf graphics files produced with R

2007-05-22 Thread Sundar Dorai-Raj
You need not buy Acrobat. There are two free software programs that will compress pdf files: http://www.cutepdf.com http://www.cs.wisc.edu/~ghost/ (and in particular GSView) They both allow several levels of compression. Thanks, --sundar Chabot Denis said the following on 5/22/2007 3:32 AM:

Re: [R] Abline in dotplot

2007-05-16 Thread Sundar Dorai-Raj
Thompson, Valeria V said the following on 5/16/2007 12:04 PM: Hello, I have trouble adding an abline to a dotplot() from lattice package. For example, I would like to draw a line at x=3: library(lattice) x-1:5 names(x) - c(a, b, c, d, e) dotplot(sample(x)) panel.abline(v=3)

Re: [R] what fun I need to put in this tapply

2007-05-14 Thread Sundar Dorai-Raj
Weiwei Shi said the following on 5/14/2007 11:04 AM: Hi, I happened to need generate the following t1 V1 V2 count count2 1 1 11 2 3 2 1 12 2 2 3 2 11 1 3 4 3 13 3 1 5 3 11 3 3 6 3 12 3 2 from V1 V2 1 1 11 2 1 12 3

Re: [R] like apply(x,1,sum), but using multiplication?

2007-05-07 Thread Sundar Dorai-Raj
Jose Quesada said the following on 5/7/2007 11:25 AM: Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,*) I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary

Re: [R] Bad optimization solution

2007-05-07 Thread Sundar Dorai-Raj
Paul Smith said the following on 5/7/2007 3:25 PM: On 5/7/07, Paul Smith [EMAIL PROTECTED] wrote: I think the problem is the starting point. I do not remember the details of the BFGS method, but I am almost sure the (.5, .5) starting point is suspect, since the abs function is not

Re: [R] Alternatives to unlist()

2007-05-04 Thread Sundar Dorai-Raj
Jacques Wagnor said the following on 5/4/2007 8:53 AM: Given the following, one of the things I am trying to see is what % of draws are below a certain number: lambda - 3 rate - 5 n - 5 set.seed(123) v - replicate(n, rexp(rpois(1,lambda), rate)) vv - unlist(v) cat(% of draws below

Re: [R] R package development in windows

2007-05-03 Thread Sundar Dorai-Raj
Doran, Harold said the following on 5/3/2007 11:32 AM: I'm attempting to build an R package for distribution and am working from the directions found at http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#Wi n-Win I've read through Writing R Extensions and various other

Re: [R] stringification magic in subset?

2007-05-02 Thread Sundar Dorai-Raj
ivo welch said the following on 5/2/2007 8:13 AM: dear R wizards: I am trying to replace subset() with my own version that first checks that each name in the select statement has a corresponding name in the data set. preferably, it would have the same syntax and semantics as subset()

Re: [R] upgrade to 2.5

2007-05-02 Thread Sundar Dorai-Raj
Iasonas Lamprianou said the following on 5/2/2007 8:25 AM: Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without having to install all the packages again? Thanks Jason You may find the following link relevant.

Re: [R] upgrade to 2.5

2007-05-02 Thread Sundar Dorai-Raj
Robert A LaBudde said the following on 5/2/2007 2:39 PM: At 01:41 PM 5/2/2007, you wrote: On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Iasonas Lamprianou said the following on 5/2/2007 8:25 AM: Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without having

Re: [R] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Sundar Dorai-Raj
Li Li said the following on 5/2/2007 4:06 PM: Hi All, I found mvfft in R and fft2 in Matlab give different result and can't figure out why. My example is: In R: matrix(c(1,4,2,20), nrow=2) [,1] [,2] [1,]12 [2,]4 20 mvfft(matrix(c(1,4,2,20), nrow=2)) [,1]

Re: [R] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Sundar Dorai-Raj
Li Li said the following on 5/2/2007 7:53 PM: Thanks for both replies. Then I found the ifft2 from Matlab gives different result from fft( , inverse=T) from R. An example: in R: temp - matrix(c(1,4,2, 20), nrow=2) fft(temp) [,1] [,2] [1,] 27+0i -17+0i [2,] -21+0i 15+0i

Re: [R] xyplot() and controlling panel.polygon()

2007-04-26 Thread Sundar Dorai-Raj
Michael Kubovy said the following on 4/26/2007 7:20 AM: Dear R-helpers, How do I tell panel.polygon what greoup and panel it applies to whithin xyplot(y ~ x | c, groups = g panel = function(x, y, groups, ...){ panel.polygon(x = xpol[c, g], y = ypol[c, g], default.units

Re: [R] xyplot source file only work with echo=TRUE

2007-04-24 Thread Sundar Dorai-Raj
Read FAQ 7.22 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f --sundar Ronaldo Reis Junior said the following on 4/24/2007 6:38 AM: Hi, I write several xyplot graphics on a source file. When I try to use source(graphics.R) the source don't

Re: [R] xyplot: Combining 'subscripts' and 'allow.multiple=T'

2007-04-20 Thread Sundar Dorai-Raj
Søren Højsgaard said the following on 4/20/2007 3:57 AM: Dear all, Consider this plot xyplot(Sepal.Length + Sepal.Width ~ Petal.Length | Species, data = iris, allow.multiple=T, outer=F, panel = function(x,y,...) { panel.xyplot(x,y,...) } ) I

Re: [R] xyplot: Combining 'subscripts' and 'allow.multiple=T'

2007-04-20 Thread Sundar Dorai-Raj
Deepayan Sarkar said the following on 4/20/2007 11:42 AM: On 4/20/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Søren Højsgaard said the following on 4/20/2007 3:57 AM: Dear all, Consider this plot xyplot(Sepal.Length + Sepal.Width ~ Petal.Length | Species, data = iris

Re: [R] Positioning in xyplot

2007-04-11 Thread Sundar Dorai-Raj
Michael Kubovy said the following on 4/10/2007 5:54 PM: On Apr 10, 2007, at 7:07 PM, Deepayan Sarkar wrote: On 4/10/07, Michael Kubovy [EMAIL PROTECTED] wrote: Dear R-helpers, I have an xyplot of the following kind: xYplot(y ~ x | p, groups = factor(gg, levels = c('1', '5', '2', '4',

Re: [R] Positioning in xyplot

2007-04-11 Thread Sundar Dorai-Raj
Deepayan Sarkar said the following on 4/11/2007 1:55 PM: On 4/11/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Seems like you may get a workaround (albeit kludgey) by using ?print.trellis. Here's another example: library(lattice) z - expand.grid(x = 1:10, p = 1:5, r = 1:10) z$y - rnorm(nrow

Re: [R] Positioning in xyplot

2007-04-10 Thread Sundar Dorai-Raj
Michael Kubovy said the following on 4/10/2007 3:21 PM: Dear R-helpers, I have an xyplot of the following kind: xYplot(y ~ x | p, groups = factor(gg, levels = c('1', '5', '2', '4', '3')), strip = strip.custom(var.name = 'g', factor.levels = c(1', '5', '2', '4', '3'),

Re: [R] Annotate a levelplot (using abline) - Difficulty with trellis.

2007-04-04 Thread Sundar Dorai-Raj
Dan Bolser said the following on 4/4/2007 7:52 AM: My question was thus; Given library(lattice) my.m - matrix(seq(1,100,1),nrow=10) levelplot(my.m) How can I add a diagonal line onto the resulting 'color square'? The answer I found was to hack the 'panel.levelplot'

Re: [R] options(error=recover) in .Rprofile

2007-03-28 Thread Sundar Dorai-Raj
Andy Jacobson said the following on 3/28/2007 4:01 PM: Hi, I'd like to try using options(error=recover) in my ~/.Rprofile, but it appears that the function recover is not defined during R startup when the .Rprofile is processed. recover is defined after I get an R prompt, however.

Re: [R] impose points on lattice plot

2007-03-27 Thread Sundar Dorai-Raj
Luis Ridao Cruz said the following on 3/27/2007 6:15 AM: R-help, I'm using the lattice package to plot 2 variables (vekt ~ aldur) conditioned to a third (kyn * 2 categories). I use the following: xyplot(vekt ~ aldur|kyn, , data = sexSu) I want to superimpose the average(vekt) by

Re: [R] Replacement in an expression - can't use parse()

2007-03-27 Thread Sundar Dorai-Raj
Daniel Berg said the following on 3/27/2007 6:56 AM: Dear all, Suppose I have a very long expression e. Lets assume, for simplicity, that it is e = expression(u1+u2+u3) Now I wish to replace u2 with x and u3 with 1. I.e. the 'new' expression, after replacement, should be: e

Re: [R] How to drop variables using a wildcard and logic...

2007-03-26 Thread Sundar Dorai-Raj
Alternatively, you can use ?glob2rx test[, grep(glob2rx(*[tT]), names(test))] which allows for wildcards. --sundar Benilton Carvalho said the following on 3/26/2007 12:19 PM: if 'test' is your data frame... test[, grep([tT]$, names(test))] b On Mar 26, 2007, at 3:06 PM, [EMAIL

Re: [R] lattice key (legend) with both points and lines

2007-03-20 Thread Sundar Dorai-Raj
Peter McMahan said the following on 3/20/2007 3:16 PM: Hello, I'm running into a frustrating problem with the legend on a lattice plot I'm working with. The plot is a stripplot with a panel.linejoin () line running through the mean of each of the categories. Thus there are both points

Re: [R] Error in upgrade

2007-03-15 Thread Sundar Dorai-Raj
Giovanni Parrinello said the following on 3/15/2007 6:43 AM: Dear All, update.packages(ask='graphics') --- Please select a CRAN mirror for use in this session --- Error in .readRDS(pfile) : unknown input format. ??? TIA Giovanni I cannot replicate this in R-2.4.1. What version of R and

Re: [R] lattice: put key where unused panel would have been

2007-01-22 Thread Sundar Dorai-Raj
Benjamin Tyner said the following on 1/22/2007 3:18 PM: Hi, Say I have z-data.frame(y=runif(190), x=runif(190), f=gl(5,38), g=gl(19,10)) plot-xyplot(y~x|g, data=z,

Re: [R] How to get correct integration in C for step function?

2007-01-21 Thread Sundar Dorai-Raj
Hi, Lynette, A few pointers: 1. Not an R question. 2. Not an ESS question. 3. No reproducible example. 4. (x = 1/4) is comparing a pointer. Surely, this is not what you intended to do. Plus, if you're using void* then this is not even a C function called by R. And I'm not familiar with Rdqags.

Re: [R] .C interface and Strings...

2007-01-12 Thread Sundar Dorai-Raj
Stephane Cruveiller said the following on 1/12/2007 4:15 AM: Dear R users, I am trying to include C code into R via the .C interface. I have read that arguments passed to a C function have to be correctly DEreferenced. This is something that can be easily done for numbers (integers or

Re: [R] extract standard errors, write them to file

2007-01-12 Thread Sundar Dorai-Raj
Indermaur Lukas said the following on 1/12/2007 7:55 AM: Hello I want to repeatedly extract coefficients and standard errors from a GLM and write them into a file (1row=all coefficients of model A, 2 row=all coefficients of model B, etc.). I can extract coefficients but not standard

Re: [R] sapply problem

2006-12-14 Thread Sundar Dorai-Raj
Joerg van den Hoff said the following on 12/14/2006 7:30 AM: I have encountered the following problem: I need to extract from a list of lists equally named compenents who happen to be 'one row' data frames. a trivial example would be: a - list(list( df = data.frame(A = 1, B = 2, C = 3)),

Re: [R] How to use read.xls in R

2006-12-07 Thread Sundar Dorai-Raj
Lisa Wang said the following on 12/7/2006 3:01 PM: Hello there, In gdata package, read.xls is to be used for reading excel data (from windows). The following is my code:('C:/session/sampledata.xls' is where the file is stored) data1-read.xls('C:/session/sampledata.xls',sheet=1) and

Re: [R] lattice plots - variables in columns

2006-12-04 Thread Sundar Dorai-Raj
Matt Pocernich said the following on 12/4/2006 12:32 PM: I an using xyplot in lattice. I have data in a dataframe. Some columns contains data, each from a different group. Is there a direct way to specify a range of column names as a grouping variables? Currently, I am stacking the data

Re: [R] Question about error message - or is it a bug?

2006-11-10 Thread Sundar Dorai-Raj
Carmen Meier said the following on 11/10/2006 9:46 AM: Hi to all ... the same code, but another question. I changed only the type='n' to type='l' and debugged the function xy.coords. with type = 'l' : there are the correct values of x and y inside the function xy.coords but the y value is

Re: [R] combining dataframes with different numbers of columns

2006-11-07 Thread Sundar Dorai-Raj
hadley wickham said the following on 11/7/2006 8:46 PM: On 11/7/06, Denis Chabot [EMAIL PROTECTED] wrote: Dear list members, I have to combine dataframes together. However they contain different numbers of variables. It is possible that all the variables in the dataframe with fewer

Re: [R] nontabular logistic regression

2006-10-13 Thread Sundar Dorai-Raj
Jeffrey Stratford said the following on 10/13/2006 9:28 AM: Hi. I'm attempting to fit a logistic/binomial model so I can determine the influence of landscape on the probability that a box gets used by a bird. I've looked at a few sources (MASS text, Dalgaard, Fox and google) and the

Re: [R] adding error bars to lattice plots

2006-10-12 Thread Sundar Dorai-Raj
Daniel E. Bunker said the following on 10/12/2006 11:48 AM: Dear R users, About a year ago Deepayan offered a suggestion to incorporate error bars into a dotplot using the singer data as an example http://finzi.psych.upenn.edu/R/Rhelp02a/archive/63875.html. When I try to utilize this

Re: [R] R not responding for nested glm model

2006-10-12 Thread Sundar Dorai-Raj
Yuval Sapir said the following on 10/12/2006 1:08 PM: Hi, I'm trying to perform a glm model on count data (poisson distribution of the errors) where data are nested. glmmodel-glm(y~x/z,poisson) x and z are factors, z nested within x, y is count data. In that point the R just stuck and not

Re: [R] xyplot

2006-10-05 Thread Sundar Dorai-Raj
Osman Al-Radi said the following on 10/5/2006 3:43 PM: Hi, for the data below: time-c(rep(1:10,5)) y-time+rnorm(50,5,2) subject-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10)) group-c(rep('A',30),rep('B',20)) df-data.frame(subject,group,time,y) I'd like to produce a

Re: [R] safe prediction from lm

2006-09-28 Thread Sundar Dorai-Raj
Spencer Jones said the following on 9/28/2006 10:44 AM: I am fitting a regression model with a bs term and then making predictions based on the model. According to some info on the internet at http://www.stat.auckland.ac.nz/~yee/smartpred/DummiesGuide.txt there are some problems with using

Re: [R] Single Precision (4 byte) floats with readBin

2006-09-27 Thread Sundar Dorai-Raj
Peter Lauren said the following on 9/27/2006 3:11 PM: I would like to use readBin to read a binary data file. Most of the data is 4-byte floating point but, for some reason, only double precision appears to be offered. I tried fVariable=readBin(iFile,what=single()); and got 35.87879

Re: [R] Print and supressing printing in function

2006-09-24 Thread Sundar Dorai-Raj
Marc Schwartz said the following on 9/24/2006 1:56 PM: On Sun, 2006-09-24 at 11:31 -0700, Jonathan Greenberg wrote: Another newbie question for you all: In a function, say I have: countme - function() { for(i in 1:10) { i } } How do I get R to print i as it runs (e.g. By calling

Re: [R] Double integral

2006-09-22 Thread Sundar Dorai-Raj
Caio Lucidius Naberezny Azevedo said the following on 9/22/2006 4:40 PM: Hi all, I need to solve double integrals with no closed solution. Calling x and y the two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, given a joint funcion g(x,y), I need evaluate the

Re: [R] Matrix from a vector?

2006-09-21 Thread Sundar Dorai-Raj
kone said the following on 9/21/2006 2:30 PM: Hi, Is there some function, which generates this kind of n x n -matrix from a vector? rhset [1] 1792 256 13312 512 1024 2048 8192 4096 m=matrix(nrow=length(rhset),ncol=length(rhset)) for(i in 1:length(rhset)) +

Re: [R] Add percentage to pie (was (no subject))

2006-09-18 Thread Sundar Dorai-Raj
ERICK YEGON said the following on 9/18/2006 8:22 AM: Hi Gurus, i have a small problem with working with graphs on R. Say i have data say bull-c(34,23,7,4) and i assign names to the elements in the brackets if i do Pie(bull) i get a pie chart of bull togtjer with the names. Question. How

Re: [R] acos(0.5) == pi/3 FALSE

2006-09-18 Thread Sundar Dorai-Raj
Iñaki Murillo Arcos said the following on 9/18/2006 12:31 PM: Hello, I don't know if the result of acos(0.5) == pi/3 is a bug or not. It looks strange to me. Inaki Murillo __ R-help@stat.math.ethz.ch mailing list

Re: [R] dotplot, dropping unused levels of 'y'

2006-09-15 Thread Sundar Dorai-Raj
Benjamin Tyner said the following on 9/15/2006 2:36 PM: In dotplot, what's the best way to suppress the unused levels of 'y' on a per-panel basis? This is useful for the case that 'y' is a factor taking perhaps thousands of levels, but for a given panel, only a handfull of these levels

Re: [R] converting strings to expressions

2006-09-14 Thread Sundar Dorai-Raj
Deepayan Sarkar said the following on 9/14/2006 2:31 PM: Hi, consider this: -- estr - c(2^4, alpha[1]) eexp - expression(2^4, alpha[1]) ## Is it possible to get 'eexp' starting from 'estr'? The closest I could ## get was: do.call(expression, lapply(estr, as.name))

Re: [R] S in cor.test(..., method=spearman)

2006-09-13 Thread Sundar Dorai-Raj
Dietrich Trenkler said the following on 9/13/2006 9:44 AM: Dear HelpeRs, I have some data: ice - structure(c(0.386, 0.374, 0.393, 0.425, 0.406, 0.344, 0.327, 0.288, 0.269, 0.256, 0.286, 0.298, 0.329, 0.318, 0.381, 0.381, 0.47, 0.443, 0.386, 0.342, 0.319, 0.307, 0.284, 0.326,

Re: [R] levels of factor when subsetting the factor

2006-09-12 Thread Sundar Dorai-Raj
Yes. I do this periodically: dat.new - dat[1:6, ] dat.new[] - lapply(dat.new, function(x) if(is.factor(x)) factor(x) else x) HTH, --sundar Afshartous, David said the following on 9/12/2006 11:00 AM: thanks to all for the quick replies! if the factor is part of a

Re: [R] Basic help needed: group bunch of lines in a list (matrix)

2006-09-12 Thread Sundar Dorai-Raj
Emmanuel Levy said the following on 9/12/2006 3:50 PM: Hello, I'd like to group the lines of a matrix so that: A 1.0 200 A 3.0 800 A 2.0 200 B 0.5 20 B 0.9 50 C 5.0 70 Would give: A 2.0 400 B 0.7 35 C 5.0 70 So all lines corresponding to a letter (level), become a single line

Re: [R] exactly representable numbers

2006-09-11 Thread Sundar Dorai-Raj
Robin Hankin said the following on 9/11/2006 3:52 AM: Hi Given a real number x, I want to know how accurately R can represent numbers near x. In particular, I want to know the infinum of exactly representable numbers greater than x, and the supremum of exactly representable

Re: [R] legend problems in lattice

2006-09-07 Thread Sundar Dorai-Raj
Ernst O Ahlberg Helgee wrote: Hi! Im sorry to bother you but I cant fix this. I use the lattice function levelplot and I want the colorkey at the bottom, how do I get it there? I have tried changing colorkey.space and changing in legend but I cant get it right, plz help btw I'd like to

Re: [R] Extracting column name in apply/lapply

2006-08-28 Thread Sundar Dorai-Raj
Nick Desilsky wrote: Hi, any good trick to get the column names for title() aside from running lapply on the column indexes? Thanks Nick. apply(X[,numCols],2,function(x){ nunqs - length(unique(x)) nnans - sum(is.na(x)) info -

Re: [R] generating an expression for a formula automatically

2006-08-24 Thread Sundar Dorai-Raj
Maria Montez wrote: Hi! I would like to be able to create formulas automatically. For example, I want to be able to create a function that takes on two values: resp and x, and then creates the proper formula to regress resp on x. My code: fit.main - function(resp,x) { form -

Re: [R] fitting truncated normal distribution

2006-08-18 Thread Sundar Dorai-Raj
, there is a way fitdistr can also compute difficult data. Best regards, markus -Original Message- From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED] Sent: Donnerstag, 17. August 2006 16:47 To: Schweitzer, Markus Cc: r-help@stat.math.ethz.ch Subject: Re: [R] fitting truncated normal

Re: [R] fitting truncated normal distribution

2006-08-17 Thread Sundar Dorai-Raj
in advance markus Sorry, didn't notice that you *did* mention dtnorm is part of msm. Ignore that part of the advice... --sundar Sundar Dorai-Raj wrote: [EMAIL PROTECTED] wrote: Hello, I am a new user of R and found the function dtnorm() in the package msm. My problem now

Re: [R] fitting truncated normal distribution

2006-08-16 Thread Sundar Dorai-Raj
[EMAIL PROTECTED] wrote: Hello, I am a new user of R and found the function dtnorm() in the package msm. My problem now is, that it is not possible for me to get the mean and sd out of a sample when I want a left-truncated normal distribution starting at 0. fitdistr(x,dtnorm,

Re: [R] fitting truncated normal distribution

2006-08-16 Thread Sundar Dorai-Raj
Sorry, didn't notice that you *did* mention dtnorm is part of msm. Ignore that part of the advice... --sundar Sundar Dorai-Raj wrote: [EMAIL PROTECTED] wrote: Hello, I am a new user of R and found the function dtnorm() in the package msm. My problem now is, that it is not possible for me

Re: [R] Doubt about Student t distribution simulation

2006-08-04 Thread Sundar Dorai-Raj
Hi, Jose/John, Here's an example to help Jose and highlights John's advice. Also includes set.seed which should be included in all simulations posted to R-help. set.seed(42) mu - 10 sigma - 5 n - 3 nsim - 1 m - matrix(rnorm(n * nsim, mu, sigma), nsim, n) t - apply(m, 1, function(x)

[R] deleting a directory

2006-08-01 Thread Sundar Dorai-Raj
Hi, all, I'm looking a utility for removing a directory from within R. Currently, I'm using: foo - function(...) { mydir - tempdir() dir.create(mydir, showWarnings = FALSE, recursive = TRUE) on.exit(system(sprintf(rm -rf %s, mydir))) ## do some stuff in mydir invisible() }

Re: [R] deleting a directory

2006-08-01 Thread Sundar Dorai-Raj
Please ignore. I forgot ?unlink had a recursive argument. Thanks. --sundar Sundar Dorai-Raj wrote: Hi, all, I'm looking a utility for removing a directory from within R. Currently, I'm using: foo - function(...) { mydir - tempdir() dir.create(mydir, showWarnings = FALSE

Re: [R] Sweave error in example code

2006-07-31 Thread Sundar Dorai-Raj
LL wrote: Hi.. I am running R version 2.3.1 on a Windows XP machine with the latest Miktex 2.5 installed. I get no errors from R when running the Sweave example, testfile - system.file(Sweave, Sweave-test-1.Rnw, package = utils) However, when I tex the resulting .tex file (after

Re: [R] scatter plot with axes drawn on the same scale

2006-07-28 Thread Sundar Dorai-Raj
Try: plot(x, y, asp = 1) --sundar bogdan romocea wrote: Dear useRs, I'd like to produce some scatter plots where N units on the X axis are equal to N units on the Y axis (as measured with a ruler, on screen or paper). This approach x - sample(10:200,40) ; y - sample(20:100,40)

Re: [R] intersect of list elements

2006-07-21 Thread Sundar Dorai-Raj
Georg Otto wrote: Hi, i have a list of several vectors, for example: vectorlist $vector.a.1 [1] a b c $vector.a.2 [1] a b d $vector.b.1 [1] e f g I can use intersect to find elements that appear in $vector.a.1 and $vector.a.2: intersect(vectorlist[[1]],

Re: [R] throwaway() function

2006-07-20 Thread Sundar Dorai-Raj
John Wiedenhoeft wrote: Dear all, I apologize if this is a FAQ (seems a bit like one, but I didn't find anything). I'm looking for an easy way to cut one value out of a vector and shorten the vector accordingly. Something like: x - c(1, 1, 0, 6, 2) throwaway(x[3]) which will return

Re: [R] Sweave and multipage lattice

2006-07-19 Thread Sundar Dorai-Raj
Dieter Menne wrote: Dear R-Listeners, as the Sweave faq says: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html creating several figures from one figure chunk does not work, and for standard graphics, a workaround is given. Now I have a multipage trellis plot with an a-priori

Re: [R] Wrap a loop inside a function

2006-07-19 Thread Sundar Dorai-Raj
Doran, Harold wrote: I need to wrap a loop inside a function and am having a small bit of difficulty getting the results I need. Below is a replicable example. # define functions pcm - function(theta,d,score){ exp(rowSums(outer(theta,d[1:score],'-')))/

Re: [R] RODBC, missing values, and Excel

2006-07-13 Thread Sundar Dorai-Raj
in: library(gdata) setwd(/) cmd - paste(perl, system.file(perl/xls2csv.pl, package = gdata), test) system(cmd) ff - list.files(patt = test_Sheet.*.csv) sapply(ff, read.csv, na.strings = na , simplify = FALSE) On 7/12/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Hi, Gabor, Thanks for the reply. Perhaps

[R] RODBC, missing values, and Excel

2006-07-12 Thread Sundar Dorai-Raj
Hi, all, I'm trying to use RODBC to read data from Excel. However, I'm having trouble converting missing values to NA and rather perplexed by the output. Below illustrates my problem: ## DATA - copy to Excel and save as tmp.xls ## tmp.xls!Sheet1 x 0.11 0.11 na na na 0.11 ## tmp.xls!Sheet2 x

Re: [R] RODBC, missing values, and Excel

2006-07-12 Thread Sundar Dorai-Raj
1 0.11 2 0.11 3 NA 4 NA 5 NA 6 NA 7 0.11 R.version.string # XP [1] Version 2.3.1 Patched (2006-06-04 r38279) packageDescription(gdata)$Version [1] 2.1.2 packageDescription(RODBC)$Version [1] 1.1-7 On 7/12/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Hi, all

Re: [R] use of NULL environment is deprecated?

2006-07-11 Thread Sundar Dorai-Raj
Patrick Connolly wrote: ] version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status

Re: [R] Colinearity Function in R

2006-07-05 Thread Sundar Dorai-Raj
Peter Lauren wrote: Is there a colinearty function implemented in R? I have tried help.search(colinearity) and help.search(collinearity) and have searched for colinearity and collinearity on http://www.rpad.org/Rpad/Rpad-refcard.pdf but with no success. Many thanks in advance, Peter

Re: [R] i suspect that there a memory leak in vmmin?

2006-07-05 Thread Sundar Dorai-Raj
Vumani Dlamini wrote: Dear listers, Am currently using MCMC approaches to estimate some parameters of my model. One parameter has to be updated using a tuned gamma distribution. So at each iteration I estimate the mean and variance of the density of the gamma approximation using vmmin (i

Re: [R] numerical integration problem

2006-06-29 Thread Sundar Dorai-Raj
przeszczepan wrote: Hi, I have got problems integrating the following function using integrate: lambdat-function(t){ tempT-T[k,][!is.na(T[k,])]#available values from k-th row of matrix T tempJ-J[k,][!is.na(J[k,])] hg-length(tempT[tempT=t tempJ==0])#counts observations satisfing the

Re: [R] How to generate a figure using par( ) with some densityplot( )'s

2006-06-26 Thread Sundar Dorai-Raj
Amir Safari wrote: Hi Dear R users, For a pair plotting, usaully we use par( ) function. Apparently it does not work anywhere. I want to have 3 plots in a single figure, like this: par(mfrow=c(3,1)) densityplot( a) densityplot(b) densityplot(c) But it does not work.

Re: [R] Finding a color code.

2006-06-26 Thread Sundar Dorai-Raj
A Ezhil wrote: Hi, Is it possible to find corresponding color code in R for the following RGB (R185, G35 B80)? Thanks in advance. Best regards, Ezhil How about: x - c(185, 35, 80) class(x) - hexmode paste(#, paste(format(x), collapse = ), sep = ) [1] #b92350 I found this

Re: [R] How to generate a figure using par( ) with some densityplot( )'s

2006-06-26 Thread Sundar Dorai-Raj
Deepayan Sarkar wrote: On 6/26/06, Sundar Dorai-Raj [EMAIL PROTECTED] wrote: Amir Safari wrote: Hi Dear R users, For a pair plotting, usaully we use par( ) function. Apparently it does not work anywhere. I want to have 3 plots in a single figure, like this: par(mfrow=c(3,1

  1   2   3   4   5   6   >