Re: [R] strwidth to lines

2009-01-05 Thread Thomas Kaliwe
Why do you take 2.54? I think you forgot a bracket... #par(mar = c(max(strwidth(names(x)) * 2.54, 4,4,2)) # #should be par(mar = c(max(strwidth(names(x))) * 2.54, 4,4,5)) #and 5 would be a better value. But this is merely trial and error?! Regards Thomas Kaliwe Henrique Dallazuanna schrieb:

Re: [R] the first and last observation for each subject

2009-01-05 Thread hadley wickham
Another application of that technique can be used to quickly compute medians by groups: gm - function(x, group){ # medians by group: sapply(split(x,group),median) o-order(group, x) group - group[o] x - x[o] changes - group[-1] != group[-length(group)] first - which(c(TRUE,

Re: [R] the first and last observation for each subject

2009-01-05 Thread William Dunlap
Arg, the 'sapply(...)' in the function was in the initial comment, gm - function(x, group){ # medians by group: sapply(split(x,group),median) but someone's mailer put a newline before the sapply gm - function(x, group){ # medians by group: sapply(split(x,group),median) so it got

Re: [R] R/octave/matlab etc.

2009-01-05 Thread luke
It is the_vectorized_ performance differences that may be in part explained by compiler settings. The interpreter overhead (not just loops) is not. luke On Mon, 5 Jan 2009, Denney, William S. wrote: Hello, I don't think that the large disparity in loop performance between Matlab, R, and

Re: [R] Introduction to R (in french)

2009-01-05 Thread Julien Barnier
Dear R users, I recently put a new version of my french introduction to R online. It is more specifically targeted at social sciences students and researchers, but could be interesting for beginners who are not really familiar with statistics and coding. The document is available (in

[R] [R-pkgs] Rattle 2.4.0 (Data Mining GUI using R)

2009-01-05 Thread Graham Williams
Version 2.4.0 of Rattle has been released to CRAN. The rattle package (http://rattle.togaware.com) is a multi platform (GNU/Linux, Mac/OSX, MS/Windows) GTK based GUI for data mining (for exploring data and building descriptive and predictive models). It has undergone a lot of development over the

Re: [R] Spatial Statistics e-book.

2009-01-05 Thread Stefan Evert
Well, I suppose he might get away with it as long as said *Brian Ripley* doesn't read this list ... ;-) Sorry, couldn't resist, Stefan On 28 Dec 2008, at 21:07, stephen sefick wrote: Is that an appropriate request? On Sun, Dec 28, 2008 at 2:14 PM, Marcus Vinicius mvi...@gmail.com wrote:

Re: [R] how specify lme() with multiple within-subject factors?

2009-01-05 Thread Douglas Bates
On Sun, Jan 4, 2009 at 5:28 PM, Bert Gunter gunter.ber...@gene.com wrote: Folks: Lme() is only able to work with nested random effects, not with crossed random effects. Not quite true. Crossed models **can** be done, albeit clumsily, via pdMatrix objects: the Bates/Pinheiro book even

Re: [R] if statement

2009-01-05 Thread Wacek Kusnierczyk
Duncan Murdoch wrote: Shruthi Jayaram wrote: Hi, How do I check for two conditions in an if loop? I want to check if a value lies between 2 other values. if isn't normally a loop, but what you want is the vectorized version, the ifelse() function. For example, A - ts(rnorm(120),

[R] transform R to C

2009-01-05 Thread Andreas Wittmann
Dear R users, i would like to transform the following function from R-code to C-code and call it from R in order to speed up the computation because in my other functions this function is called many times. `dgcpois` - function(z, lambda1, lambda2) { `f1` - function(alpha, lambda1, lambda2)

Re: [R] How can pairs of values be stored in a 2D matrix ?

2009-01-05 Thread Stavros Macrakis
On Mon, Jan 5, 2009 at 6:30 AM, mau...@alice.it wrote: My question is motivated by dealing with pairs of values, like (3,12.5), (16,2.98), and so on that are mapped to a cartesian plain (Time, Frequence) I miss C multidimensional arrays. I am trying to simulate the 3rd dimension by

Re: [R] Error : unused arguments in pairs()

2009-01-05 Thread Prof Brian Ripley
Your panel function should have a ... argument: see the help page for pairs(). Since your example is not 'self-contained' I cannot test this out On Sun, 4 Jan 2009, herwig wrote: Hi there, I am just starting in R and this might be a very basic question. I applied one on the examples

Re: [R] transform R to C

2009-01-05 Thread Charles C. Berry
On Mon, 5 Jan 2009, Andreas Wittmann wrote: Dear R users, i would like to transform the following function from R-code to C-code and call it from R in order to speed up the computation because in my other functions this function is called many times. `dgcpois` - function(z, lambda1,

Re: [R] error message of RODBC...

2009-01-05 Thread Prof Brian Ripley
No, error message from your ODBC driver ... Your table names are not valid SQL names. The details depend on the exact driver, but you could try omitting the final dollar. This may not work, in which case you may need to use an sqlQuery call. On Mon, 5 Jan 2009, giovanni parrinello wrote:

Re: [R] the first and last observation for each subject

2009-01-05 Thread William Dunlap
-Original Message- From: hadley wickham [mailto:h.wick...@gmail.com] Sent: Sunday, January 04, 2009 8:56 PM To: William Dunlap Cc: gallon...@gmail.com; R help Subject: Re: [R] the first and last observation for each subject library(plyr) # ddply is for splitting up data

[R] if statement

2009-01-05 Thread Shruthi Jayaram
Hi, How do I check for two conditions in an if loop? I want to check if a value lies between 2 other values. For example, A - ts(rnorm(120), freq=12, start=c(1992,8)) X - 0.5 Y - 0.8 I would like to create a new vector C for which C[i] is 0 if A[i] lies in between X and Y. Would be

[R] Odp: if statement

2009-01-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.01.2009 12:41:49: Hi, How do I check for two conditions in an if loop? I want to check if a value lies between 2 other values. For example, A - ts(rnorm(120), freq=12, start=c(1992,8)) X - 0.5 Y - 0.8 I would like to create a new

Re: [R] Process File Line By Line Without Slurping into Object

2009-01-05 Thread Duncan Murdoch
Gundala Viswanath wrote: Dear all, In general practice one would slurp the whole file using this method before processing the data: dat - read.table(filename) or variations of it. Is there a way we can access the file line by line without slurping/storing them into object? I am thinking

[R] Sweave data-figure coupling

2009-01-05 Thread Sebastian P. Luque
Hi, With the following Sweave minimal file: ---cut here---start-- \documentclass{article} \usepackage{Sweave} \begin{document} binom-sim= thetas - seq(0, 1, by=0.001) prior - rep(1, length(thetas)) / length(thetas) lik - dbinom(1, 1,

[R] help me

2009-01-05 Thread jolka sukyte
Hello, I am a student and I working with R. I want to ask you how to solve this integral which is shown in image attach with this letter. And how to draw this function z = 4 – x2 – y2 , width intervals x = ±1, y = ±1. Thank You. Yours sincerely, Jolanta

[R] error message of RODBC...

2009-01-05 Thread giovanni parrinello
channel - odbcConnectExcel(nuova tabella terapia occupazionale mod.xls) ## list the spreadsheets sqlTables(channel) TABLE_CAT TABLE_SCHEM TABLE_NAME 1 c:\\TABELLE DEFINITIVE\\nuova tabella terapia occupazionale mod NA

Re: [R] R/octave/matlab etc.

2009-01-05 Thread Denney, William S.
Hello, I don't think that the large disparity in loop performance between Matlab, R, and Octave is explained by compilation time performance settings. For Octave, it is well known that loops perform poorly relative to Matlab (though many other operations perform better). The reason is that

Re: [R] if statement

2009-01-05 Thread Carlos J. Gil Bellosta
Hello, If you do C - A C[A X A Y] - 0 you get what it seems you want. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Mon, 2009-01-05 at 03:41 -0800, Shruthi Jayaram wrote: A - ts(rnorm(120), freq=12, start=c(1992,8)) X - 0.5 Y - 0.8

[R] How can pairs of values be stored in a 2D matrix ?

2009-01-05 Thread mauede
My question is motivated by dealing with pairs of values, like (3,12.5), (16,2.98), and so on that are mapped to a cartesian plain (Time, Frequence) I miss C multidimensional arrays. I am trying to simulate the 3rd dimension by declaring a matrix of lists. R seems to accept the definition of

Re: [R] eval using a environment X but resultsin .GlobalEnv

2009-01-05 Thread Duncan Murdoch
Saptarshi Guha wrote: Hello, Suppose I have an expression, E, which accesses some variables present in an environment V. I do this via eval(E,envir=V) however all assignments end up in V. I would like the results of assignments in E to end up in the .GlobalEnv ? Or at least the calling

[R] exportPattern wiht perl expressions

2009-01-05 Thread Biczok Rudolf
Hi com, I'm writing an R extension which uses a NAMESPACE file. Well I want to export all objects which don't have an prefix as part of name. Something like: exportPattern(^(?!prefix).+?, perl = TRUE) but it does not work Is there any way to do this? Cheers Biczok

Re: [R] Sweave data-figure coupling

2009-01-05 Thread Sebastian P. Luque
On Mon, 05 Jan 2009 15:14:37 -0500, Duncan Murdoch murd...@stats.uwo.ca wrote: [...] You missed an @ after this chunk. If this is true in the original, I'm surprised Sweave didn't report an error, but it probably ate up the second chunk as part of the first. AFAIK there's no need to

Re: [R] Sweave data-figure coupling

2009-01-05 Thread Philipp Pagel
On Mon, Jan 05, 2009 at 01:52:00PM -0600, Sebastian P. Luque wrote: binom-sim-fig, fig=TRUE, include=FALSE, height=3, echo=FALSE= layout(matrix(1:2, ncol=2)); par(mar=c(5, 4, 2, 1), cex=0.75) matplot(thetas, cbind(prior, lik, post), type=l, lty=c(2, 1, 1), xlab=theta, ylab=probability

[R] read.mtp file read error

2009-01-05 Thread thomas . ruscitti
Hi, I tried for the first time the function read.mtp, and get a file read error. Searching the archive didn't bring anything up on this. read.mtp(junk.mtp) Error in read.mtp(junk.mtp) : file read error The file is a portable Minitab v15 file, numeric only. Of course there are workarounds,

Re: [R] Ratetable creation

2009-01-05 Thread Terry Therneau
Can anyone can help me in creation ratetable object assuming, that I have mortality rates organized in standard way by year, gender and age (0-99). Look at technical report #63, Expected Survival Based on Hazard Rates, Department of Health Science Research, Mayo Clinic. You can find it on

Re: [R] Sweave data-figure coupling

2009-01-05 Thread Duncan Murdoch
On 1/5/2009 2:52 PM, Sebastian P. Luque wrote: Hi, With the following Sweave minimal file: ---cut here---start-- \documentclass{article} \usepackage{Sweave} \begin{document} binom-sim= thetas - seq(0, 1, by=0.001) prior - rep(1,

Re: [R] the first and last observation for each subject

2009-01-05 Thread Kingsford Jones
Here's some more timing's of Bill's function. Although in this example sapply has a clear performance advantage for smaller numbers of groups (k) , gm is substantially faster for k 1000: gm - function(x, group){ # medians by group: o-order(group, x) group - group[o] x - x[o]

Re: [R] How to capture multiple graph pages to .png ?

2009-01-05 Thread Greg Snow
I suspect that the graph not printing when the if statement follows the command (even commented out), may be faq 7.22, you are making the R parser guess at what you want and sometimes it guesses correctly, and sometimes not. If you wrap your call to levelplot in a print function call, then R

Re: [R] R badly lags matlab on performance?

2009-01-05 Thread luke
On Sun, 4 Jan 2009, Stavros Macrakis wrote: On Sun, Jan 4, 2009 at 4:50 PM, l...@stat.uiowa.edu wrote: On Sun, 4 Jan 2009, Stavros Macrakis wrote: On Sat, Jan 3, 2009 at 7:02 PM, l...@stat.uiowa.edu wrote: R's interpreter is fairly slow due in large part to the allocation of argument lists

Re: [R] the first and last observation for each subject

2009-01-05 Thread Kingsford Jones
whoops -- I left the group size unchanged so k became greather than the length of the group vector. When I increase the size to 1e7, sapply is faster until it gets to k = 1e6. warning: this takes awhile (particularly on my machine which seems to be using just 1 of it's 2 cpus) for(k in

[R] adding a curve with xaxs=i

2009-01-05 Thread Valentina Kraus
I want the curve to touch the y axis like the curve touches the upper boundary. How can I eliminate the margin between axis and curve on the left side? x1 - c(1,2,3,4,5) x2 - c(2,4,6,8,10) mod - lm (x2~x1) hm - function (x) (mod$coe[1]+x*mod$coe[2]) plot.new() # ... box() curve

Re: [R] Error : unused arguments in pairs()

2009-01-05 Thread herwig
Dear Prof. Ripley, thanks for your reply. Unfortunately I still was not able to solve the problem. I tried it with the Iris data and you can find the code below: panel.cor - function(x, y, digits=2, prefix=, cex.cor) { usr - par(usr); on.exit(par(usr)) par(usr = c(0, 1, 0, 1))

[R] prblem with NA

2009-01-05 Thread kayj
Hi all I have a data set with the total number of columns =ncol, and the total number of rows=nrow. I am trying to loop over the values and id the value is less than or equal to 100 to be changed to 1. if the value is greater than 100 , to be changed to 0. if NA , let X[i,j]=NA. I ran into a

[R] RODBC connection die - using more than 1 Rgui/Rcmdr

2009-01-05 Thread jaey.ahn
Hi, I encounter a problem when using more than 1 Rgui/Rcmdr with RODBC connection. As I use more than 1 RODBC connection with multiple Rgui/Rcmdr windows, my network connection (including internet) is shutting down. Thus the only solution to fix (so far) is to reboot the computer. I suppose

Re: [R] How to capture multiple graph pages to .png ?

2009-01-05 Thread Mike Williamson
Greg, others, Thanks for the info! I suspect you are right, Greg. The main issue, as Sundar Dorai-Raj (who posts here at times) told me in person and you say indirectly below, is that the levelplot function returns an object and not a graph. I didn't really know what that *meant*, even

Re: [R] RODBC connection die - using more than 1 Rgui/Rcmdr

2009-01-05 Thread Duncan Murdoch
On 05/01/2009 6:42 PM, jaey.ahn wrote: Hi, I encounter a problem when using more than 1 Rgui/Rcmdr with RODBC connection. As I use more than 1 RODBC connection with multiple Rgui/Rcmdr windows, my network connection (including internet) is shutting down. Thus the only solution to fix (so far)

Re: [R] How to capture multiple graph pages to .png ?

2009-01-05 Thread Deepayan Sarkar
On Mon, Jan 5, 2009 at 4:57 PM, Mike Williamson this.is@gmail.com wrote: Greg, others, Thanks for the info! I suspect you are right, Greg. The main issue, as Sundar Dorai-Raj (who posts here at times) told me in person and you say indirectly below, is that the levelplot function

Re: [R] adding a curve with xaxs=i

2009-01-05 Thread David Winsemius
See if this gets you closer to what you want. x1 - c(1,2,3,4,5) x2 - c(2,4,6,8,10) mod - lm (x2~x1) hm - function (x) (mod$coe[1]+x*mod$coe[2]) plot.new() # ... box() curve (hm,lty=1,xaxs=i, xlim=c(0,1), yaxs=i, xlab=, xaxt=n ) Seemed as though the , add=TRUE, parameter was getting in