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

2009-01-02 Thread Carlos J. Gil Bellosta
Hello, Is is truly y=max(y)-min(y) what you want below? Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Fri, 2009-01-02 at 13:16 -0500, Stavros Macrakis wrote: > I think there's a pretty simple solution here, though probably not the > most efficient: > > t(sapply(split(a

Re: [R] interrupting R

2009-01-02 Thread Prof Brian Ripley
On Fri, 2 Jan 2009, Markus Loecher wrote: Thank you for the quick reply. It seems that Ctrl-C interrupts "pure" R functions (i.e. R scripts that do not call external compiled libraries) but when I run functions that in turn call external C code (such as gam() in the package mgcv), the Ctrl-C doe

Re: [R] runif limited precision

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 7:33 PM, Stavros Macrakis wrote: On Fri, Jan 2, 2009 at 5:56 PM, Duncan Murdoch wrote: I don't agree. If you add too much technical detail to a topic, then people don't "work through it". I'd say the r pages generally give enough detail now, but not too much. If you add every d

Re: [R] runif limited precision

2009-01-02 Thread Stavros Macrakis
On Fri, Jan 2, 2009 at 5:56 PM, Duncan Murdoch wrote: > I don't agree. If you add too much technical detail to a topic, then people > don't "work through it". I'd say the r pages generally give enough > detail now, but not too much. If you add every detail that might interest > someone somewher

Re: [R] runif limited precision

2009-01-02 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Duncan Murdoch > Sent: Friday, January 02, 2009 2:57 PM > To: Stavros Macrakis > Cc: r-help@r-project.org > Subject: Re: [R] runif limited precision > > On 02/01/2009 4:16 PM, St

Re: [R] computing on expressions

2009-01-02 Thread Vadim Ogranovich
The following seems to work too: expr2 <- expression(a>0) expr2 <- as.expression( bquote(.(expr2[[1]]) & b>0 ) ) Here as.expression converts the 'call' type returned by bquote to 'expression' type. Thanks again Dunkan. Vadim -Original Message- From: Duncan Murdoch [mailto:murd...@stat

Re: [R] runif limited precision

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 4:16 PM, Stavros Macrakis wrote: On Fri, Jan 2, 2009 at 4:03 PM, Duncan Murdoch wrote: On 02/01/2009 2:45 PM, Stavros Macrakis wrote: ...So I'd think that either runif should give full precision or its documentation should mention this limitation. It refers to the .Random.seed p

[R] Parallel computing with snow

2009-01-02 Thread Gang Chen
I've been using parApply() in snow package for parallel computing with the following lines in R 2.8.1: library(snow) nNodes <- 4 cl <- makeCluster(nNodes, type = "SOCK") fm <- parApply(cl, myData, c(1,2), func1, ...) Since I have a Mac OS X (version 10.4.11) with two dual-core processors,

Re: [R] Spatial Data Analysis in R [was: Basic Question about use of R]

2009-01-02 Thread Kingsford Jones
resending to provide a more informative subject line On Fri, Jan 2, 2009 at 3:21 PM, Kingsford Jones wrote: > Hi David, > > A general answer to your question is: yes, R would be useful for such > analyses - particularly when interfaced with a GIS. For an > introduction to the types of spatia

Re: [R] Basic Question about use of R

2009-01-02 Thread Kingsford Jones
Hi David, A general answer to your question is: yes, R would be useful for such analyses - particularly when interfaced with a GIS. For an introduction to the types of spatial tools available in R see the Task View for spatial data: http://cran.r-project.org/web/views/Spatial.html Below are a fe

Re: [R] runif limited precision

2009-01-02 Thread Stavros Macrakis
On Fri, Jan 2, 2009 at 4:03 PM, Duncan Murdoch wrote: > On 02/01/2009 2:45 PM, Stavros Macrakis wrote: >> ...So I'd think that either runif should give full precision or >> its documentation should mention this limitation. > > It refers to the .Random.seed page for details, and that page mentions

Re: [R] interrupting R

2009-01-02 Thread Markus Loecher
Thank you for the quick reply. It seems that Ctrl-C interrupts "pure" R functions (i.e. R scripts that do not call external compiled libraries) but when I run functions that in turn call external C code (such as gam() in the package mgcv), the Ctrl-C does not appear to propagate that deeply, if I m

Re: [R] runif limited precision

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 2:45 PM, Stavros Macrakis wrote: runif appears to give 31 bits of precision, but this isn't mentioned in the documentation page. The R numeric type supports 53 digits of precision, and other numeric functions (sin, etc.) give full-precision results. So I'd think that either runif s

Re: [R] Randomly remove condition-selected rows from a matrix

2009-01-02 Thread Stavros Macrakis
There is another undocumented glitch in sample: sample(2^31-1,1) => OK sample(2^31 ,1) => Error I suppose you could interpret "sampling takes place from '1:x' " to mean that 1:x is actually generated, but that doesn't work as an explanation either; on my 32-bit Windows box, 1:(2^29) giv

[R] runif limited precision

2009-01-02 Thread Stavros Macrakis
runif appears to give 31 bits of precision, but this isn't mentioned in the documentation page. The R numeric type supports 53 digits of precision, and other numeric functions (sin, etc.) give full-precision results. So I'd think that either runif should give full precision or its documentation sh

Re: [R] Randomly remove condition-selected rows from a matrix

2009-01-02 Thread Wacek Kusnierczyk
xxx wrote: > On Fri, Jan 2, 2009 at 10:07 AM, Wacek Kusnierczyk > wrote: > >> ... 'sample' takes a sample of the specified size from the elements of >> 'x' using either with or without replacement. >> >> x: Either a (numeric, complex, character or logical) vector of >> mo

[R] Basic Question about use of R

2009-01-02 Thread David Greene
Dear Sirs: I am not yet a user of R. My background includes the use of (Turbo) Pascal for scientific analysis of underwater acoustics problems (e.g. sound ray tracing and array gain in directional noise fields.) I have become interested in the following type of problem: (1) select , say, 1000

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

2009-01-02 Thread Stavros Macrakis
I think there's a pretty simple solution here, though probably not the most efficient: t(sapply(split(a,a$ID), function(q) with(q,c(ID=unique(ID),x=unique(x),y=max(y)-min(y) Using 'unique' instead of min or [[1]] has the advantage that if x is in fact not time-invariant, this gives an err

Re: [R] Where to find old R packages?

2009-01-02 Thread Prof Brian Ripley
You mean like the 'Archive' on CRAN? It is linked from the main packages page, at the bottom. However, I've not heard of that package on CRAN, and it is not in the Windows binary list from 2004 for R 1.7.x. I don't think it ever was on CRAN. Try www.agric.wa.gov.au, which is where Google s

Re: [R] Where to find old R packages?

2009-01-02 Thread Marc Schwartz
on 01/02/2009 08:38 AM francogrex wrote: > What happens to old R packages? Is there a place where they are stored like > an archive? I'm looking for a package called ScanoR that doesn't exist > anymore on CRAN, the author doesn't exist anymore... I had made copies of > all packages (fearing that so

[R] Gracias Instalación de WinEdt para R

2009-01-02 Thread Ale Garcia
Good morning and good year :D Thanks so much, I did what you told me (that actually was the same I was doing but wit a previus version of R and WinEdt) and it worked out well. Thank's again. On Thu, Jan 1, 2009 at 8:28 AM, Uwe Ligges wrote: > Well, I really cannot understand everything in your

Re: [R] "registering" a generic method for a class

2009-01-02 Thread m.u.r.
perfect... I thought it was "print". thanks much! On Jan 2, 3:13 am, Matthias Kohl wrote: > In case of S4 objects "show" is called. Hence, you should implement new > S4-methods for show ... > > Matthias > > > > m.u.r. wrote: > > Sorry in advance if this is too simple a question, but I'm stuck

[R] [Fwd: Re: Interval censored Data in survreg() with zero values!]

2009-01-02 Thread Geraldine Henningsen
--- Begin Message --- Apologies -- you are being more subtle than I thought. Nevertheless, I think that the censoring language isn't quite right. You are thinking of a hierarchical model: z ~ N(Xb, sigma), where Xb is the linear predictor, whatever covariates you think belong in the m

[R] Where to find old R packages?

2009-01-02 Thread francogrex
What happens to old R packages? Is there a place where they are stored like an archive? I'm looking for a package called ScanoR that doesn't exist anymore on CRAN, the author doesn't exist anymore... I had made copies of all packages (fearing that some might be "taken off the air" but unfortuantel

[R] Calculating signicance value

2009-01-02 Thread Moumita Das
Hi friends, If someone can find out some time to go through my problem would be really grateful. I have a dataset(dataset1) as shown below:-- recmeanC1 recmeanC2 recmeanC3recmeanC4 i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 1 NA 1 1.00 1.8

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

2009-01-02 Thread Frank E Harrell Jr
Here is a fast approach using the Hmisc package's summarize function. > g <- function(w) { + time <- w[,'time']; y <- w[,'y'] + c(y[which.min(time)], y[which.max(time)])} > > with(DF, summarize(DF, ID, g, stat.name=c('first','last'))) ID first last 1 120 40 2 223 38 3 310

Re: [R] Randomly remove condition-selected rows from a matrix

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 10:07 AM, Wacek Kusnierczyk wrote: Stavros Macrakis wrote: On Wed, Dec 31, 2008 at 12:44 PM, Guillaume Chapron wrote: m[-sample(which(m[,1]<8 & m[,2]>12),2),] Supposing I sample only one row among the ones matching my criteria. Then consider the case where there is jus

Re: [R] Randomly remove condition-selected rows from a matrix

2009-01-02 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > On Wed, Dec 31, 2008 at 12:44 PM, Guillaume Chapron > wrote: > >>> m[-sample(which(m[,1]<8 & m[,2]>12),2),] >>> >> Supposing I sample only one row among the ones matching my criteria. Then >> consider the case where there is just one row matching this criteria.

Re: [R] interrupting R

2009-01-02 Thread Prof Brian Ripley
On Fri, 2 Jan 2009, Markus Loecher wrote: Dear fellow R users, is there a generic way to gracefully interrupt an R function without terminating the entire session ? I am mainly interested in this answer for Linux and MacOS. I found neither Esc nor Ctrl-C to work; it seems that R does not check f

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

2009-01-02 Thread hadley wickham
On Fri, Jan 2, 2009 at 3:20 AM, gallon li wrote: > I have the following data > > ID x y time > 1 10 20 0 > 1 10 30 1 > 1 10 40 2 > 2 12 23 0 > 2 12 25 1 > 2 12 28 2 > 2 12 38 3 > 3 5 10 0 > 3 5 15 2 > . > > x is time invariant, ID is the subject id number, y is changing over time. > > I want

Re: [R] text rather than html help in Windows

2009-01-02 Thread Tom La Bone
Duncan Murdoch-2 wrote: > > Whoops, sorry, Uwe's advice is right. Text help is only the default > when run outside a console; I use Cygwin, which doesn't look like a > console to R. > I am using eclipse with StatET to run R under Ubuntu 8.04 and Windows XP Pro. I would like both implementat

[R] interrupting R

2009-01-02 Thread Markus Loecher
Dear fellow R users, is there a generic way to gracefully interrupt an R function without terminating the entire session ? I am mainly interested in this answer for Linux and MacOS. I found neither Esc nor Ctrl-C to work; it seems that R does not check for signals periodically? Also, an entirely u

[R] Fw: GPD/GEV export results for plot

2009-01-02 Thread Benjamin Modra
Hi all, I'd like to export the results of GPD or GEV analysis generated with the Extremes Toolbox for plotting in Grapher or Excel (for manipulation by our publications group). Is it possible to access the data used to generate the plots in extRemes, or do I need to code the analysis from scra

Re: [R] text rather than html help in Windows

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 8:11 AM, Tom La Bone wrote: I would like to use Rterm in Windows XP and have the help files appear in text format in the terminal rather than in the html popup window. For example, I would like to enter help(lm) and get the text to appear in the terminal window. Can anyone suggest a

Re: [R] text rather than html help in Windows

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 8:11 AM, Tom La Bone wrote: I would like to use Rterm in Windows XP and have the help files appear in text format in the terminal rather than in the html popup window. For example, I would like to enter help(lm) and get the text to appear in the terminal window. Can anyone suggest a

Re: [R] text rather than html help in Windows

2009-01-02 Thread Uwe Ligges
Tom La Bone wrote: I would like to use Rterm in Windows XP and have the help files appear in text format in the terminal rather than in the html popup window. For example, I would like to enter help(lm) and get the text to appear in the terminal window. Can anyone suggest a way to do this? Than

[R] text rather than html help in Windows

2009-01-02 Thread Tom La Bone
I would like to use Rterm in Windows XP and have the help files appear in text format in the terminal rather than in the html popup window. For example, I would like to enter help(lm) and get the text to appear in the terminal window. Can anyone suggest a way to do this? Thanks and Happy Hew Year.

Re: [R] segfault while running an R script

2009-01-02 Thread Uwe Ligges
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. That means, at least: - R Version? - OS? - MinFileLen? Uwe Ligges mau...@alice.it wrote: > MS <- floor (log2 (MinFileLen)) #NUMBER OF DECOM

[R] segfault while running an R script

2009-01-02 Thread mauede
> MS <- floor (log2 (MinFileLen)) #NUMBER OF DECOMPOSITION LEVELS *** caught segfault *** address 0x31343142, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Any idea ? Thank

Re: [R] R: numerical integration problems

2009-01-02 Thread Duncan Murdoch
On 02/01/2009 6:37 AM, Allan Clark wrote: hello all happy new year and hope you r having a good holiday. i would like to calculate the expectation of a particular random variable and would like to approximate it using a number of the functions contained in R. decided to do some experimentat

[R] R: numerical integration problems

2009-01-02 Thread Allan Clark
hello all happy new year and hope you r having a good holiday. i would like to calculate the expectation of a particular random variable and would like to approximate it using a number of the functions contained in R. decided to do some experimentation on a trivial example. example ==

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

2009-01-02 Thread Gabor Grothendieck
Try this: > Lines <- "ID x y time + 1 10 20 0 + 1 10 30 1 + 1 10 40 2 + 2 12 23 0 + 2 12 25 1 + 2 12 28 2 + 2 12 38 3 + 3 5 10 0 + 3 5 15 2" > DF <- read.table(textConnection(Lines), header = TRUE) > aggregate(DF[3], DF[1:2], function(x) tail(x, 1) - head(x, 1)) ID x y 1 3 5 5 2 1 10 20

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

2009-01-02 Thread Jorge Ivan Velez
Dear Gallon, Assuming that your data is called "mydata", something like this should do the job: newdf<-data.frame( ID = unique(mydata$ID), x = unique(mydata$x), y = with(mydata,tapply(y,ID,function(m) tail(m,1)-head(m,1))) ) newdf HTH, Jorge On Fri, J

[R] GPD/GEV export results for plot

2009-01-02 Thread Benjamin Modra
Hi, I'd like to export the results of GPD or GEV analysis generated with the Extremes Toolbox for plotting in Grapher or Excel (for manipulation by our publications group). Is it possible to access the data used to generate the plots in extRemes, or do I need to code the analysis from scratch

[R] arima function fix the coefficients

2009-01-02 Thread bernardo lagos alvarez
Dear all, How can I fix the all coefficients of ar and ma, except for the sigma? Hoping this helps, Bernardo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/p

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

2009-01-02 Thread Carlos J. Gil Bellosta
Hello, First, order your data by ID and time. The columns you want in your output dataframe are then unique(ID), tapply( x, ID, function( z ) z[ 1 ] ) and tapply( y, ID, function( z ) z[ lenght( z ) ] - z[ 1 ] ) Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com On Fri, 2009

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

2009-01-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.01.2009 10:20:23: > I have the following data > > ID x y time > 1 10 20 0 > 1 10 30 1 > 1 10 40 2 > 2 12 23 0 > 2 12 25 1 > 2 12 28 2 > 2 12 38 3 > 3 5 10 0 > 3 5 15 2 > . > > x is time invariant, ID is the subject id number, y is changing ove

[R] the first and last observation for each subject

2009-01-02 Thread gallon li
I have the following data ID x y time 1 10 20 0 1 10 30 1 1 10 40 2 2 12 23 0 2 12 25 1 2 12 28 2 2 12 38 3 3 5 10 0 3 5 15 2 . x is time invariant, ID is the subject id number, y is changing over time. I want to find out the difference between the first and last observed y value for each

[R] Odp: Time series | average

2009-01-02 Thread Petr PIKAL
Hi I assume that maybe package zoo and na.locf could help you. Petr r-help-boun...@r-project.org napsal dne 02.01.2009 09:44:00: > Hi, > > I hope that someone can help me write the right commands. > I have a data set with 3 columns > > player_name|number_goals|year|day > > not every player i

Re: [R] Plotting a kriging on a map

2009-01-02 Thread prabhakar1223
Hi... As u stated earlier that u r able to plot map for kriging As i am new to kriging can you please send me the kriging code for a vector file.. Thanks in Advance Rodrigo Aluizio wrote: > > Hi list, > > Well, this time I’ve a doubt with mapping generation. > > I was al

Re: [R] ggplot: adding layer using different data, groups and also controlling appearance

2009-01-02 Thread ONKELINX, Thierry
Dear Juliet, I think you want this dataset <- rbind(foo, bar) ggplot(dataset, aes(x = x, y = y, colour = membership)) + geom_point() + scale_colour_manual(values = c("green", "red", "black")) HTH, Thierry ir. Thier

[R] Time series | average

2009-01-02 Thread Abeba Tensai
Hi, I hope that someone can help me write the right commands. I have a data set with 3 columns player_name|number_goals|year|day not every player is listed for every year-day-hour I would like to compute the "growth rate" of each player A so if player scored on day X 3 goals and on day X+1 6 go

Re: [R] Reading file from remote location or network drive.

2009-01-02 Thread Prof Brian Ripley
This is an FAQ (both in the main FAQ and the rw-FAQ) http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-file-names-work-in-Windows_003f http://cran.r-project.org/bin/windows/base/rw-FAQ.html#R-can_0027t-find-my-file You may find it easier to map your network drives: most users do. See also ?Qu

Re: [R] Reading file from remote location or network drive.

2009-01-02 Thread ONKELINX, Thierry
Dear Harsh, You have to replace each "\" with "\\" or try to use "/" instead. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, method

Re: [R] "registering" a generic method for a class

2009-01-02 Thread Matthias Kohl
In case of S4 objects "show" is called. Hence, you should implement new S4-methods for show ... Matthias m.u.r. wrote: Sorry in advance if this is too simple a question, but I'm stuck with some odd behavior and I can't find the text to rid myself of this (admittedly somewhat trivial) problem.