Re: [R] how to remove and add data in a list

2008-09-20 Thread jim holtman
> x <- c(12,13,15,20,33) > x [1] 12 13 15 20 33 > x[x != 15] [1] 12 13 20 33 > c(x,1,2,3,4) [1] 12 13 15 20 33 1 2 3 4 > On Sat, Sep 20, 2008 at 10:19 PM, Severino Salmo III <[EMAIL PROTECTED]> wrote: > > hi, > > i have a simple question. > > if i have a set of numbers within a given list, how

[R] Variable Selection for data reduction and discriminant anlaysis

2008-09-20 Thread Gareth Campbell
Hello all, I'm dealing with geochemical analyses of some rocks. If I use the full composition (31 elements or variables), I can get reasonable separation of my 6 sources. Then when I go onto do LDA with the 6 groups, I get excellent separation. I feel like I should be reducing the variables to

[R] how to remove and add data in a list

2008-09-20 Thread Severino Salmo III
hi, i have a simple question. if i have a set of numbers within a given list, how do i remove a number within that list. Like, if I have water(10, 15, 20, 25, 30) what is the command to remove 15? what is the command to add new numbers? thanks so much, sev -- View this message in context:

[R] Ng-Perron Tests for Unit Roots

2008-09-20 Thread Ben Domingue
Hello, I've searched all the standard spots, and I can't find any implementation of the Ng-Perron test for unit roots. I am aware of the PP tests in urca. Anybody know of something I missed? Thanks, Ben __ R-help@r-project.org mailing list https://sta

Re: [R] diff() for panel data

2008-09-20 Thread jim holtman
use "split' to split your dataframe by country and then do the diff. On Sat, Sep 20, 2008 at 8:54 PM, Gabriel Paul Mihalache <[EMAIL PROTECTED]> wrote: > I was suggested that more details with help re: my question on first > differences in panel data... > The data set in question is PWT6.2: > >> s

Re: [R] diff() for panel data

2008-09-20 Thread Gabriel Paul Mihalache
> This doesn't help you immediately, but in the next couple of days I'll > be releasing the plyr function which would allow you do something > like: Thank you! I'm looking forward to it! Meanwhile, Mark Leeds sent me exactly the code I needed. (Using split() to get df-s by country and then just u

Re: [R] diff() for panel data

2008-09-20 Thread hadley wickham
Hi Gabriel, On Sat, Sep 20, 2008 at 7:54 PM, Gabriel Paul Mihalache <[EMAIL PROTECTED]> wrote: > I was suggested that more details with help re: my question on first > differences in panel data... > The data set in question is PWT6.2: > >> str(pwt6.2) > 'data.frame': 10340 obs. of 27 variables:

Re: [R] Searching a relativ maximum of a matrix

2008-09-20 Thread Jorge Ivan Velez
Dear Chris, If 'x' is your matrix, you could try this: tail(sort(apply(x,1,max)),2) HTH, Jorge On Sat, Sep 20, 2008 at 8:48 PM, Chris82 <[EMAIL PROTECTED]> wrote: > > Hello R users, > > is there a possibility to get the relativ maximum of a matrix? > To get the absolut maximum I use max(matri

[R] diff() for panel data

2008-09-20 Thread Gabriel Paul Mihalache
Hello, everyone! I'd like to find out how I can do first log differences in a panel? (The Penn World Table data that's available in the PWT package) The regular diff() function ignores the country/index/"panel unit", with depressing results. A second request, how can I best "filter" the data (e.g.

Re: [R] diff() for panel data

2008-09-20 Thread Gabriel Paul Mihalache
I was suggested that more details with help re: my question on first differences in panel data... The data set in question is PWT6.2: > str(pwt6.2) 'data.frame': 10340 obs. of 27 variables: $ country: Factor w/ 188 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ... $ isocode: Factor w/ 188 leve

[R] Searching a relativ maximum of a matrix

2008-09-20 Thread Chris82
Hello R users, is there a possibility to get the relativ maximum of a matrix? To get the absolut maximum I use max(matrix) For example: The absolut maximum of this matrix is 6[3,6], but the relativ maximum is 6[3,6] and 4[7,6], because both values are the highest value in comparison to their e

Re: [R] fitting a hyperbole

2008-09-20 Thread Peter Dalgaard
stephen sefick wrote: I am not sure if I am exaggerating or not read title as hyperbola On Sat, Sep 20, 2008 at 2:20 PM, stephen sefick <[EMAIL PROTECTED]> wrote: I have got a data set that is Gross Primary Productivity ~ Total Suspended Solids it is a hyperbola just like: plot(1/c(1:1000))

Re: [R] fast value replacement in (numeric) vector

2008-09-20 Thread Ling, Gary (Electronic Trading)
yes, yes! I'm out of my mind. Thank you. -Original Message- From: hadley wickham [mailto:[EMAIL PROTECTED] Sent: Saturday, September 20, 2008 5:49 PM To: Ling, Gary (Electronic Trading) Cc: r-help@r-project.org Subject: Re: [R] fast value replacement in (numeric) vector On Sat, Sep 20,

Re: [R] fast value replacement in (numeric) vector

2008-09-20 Thread hadley wickham
On Sat, Sep 20, 2008 at 4:41 PM, Ling, Gary (Electronic Trading) <[EMAIL PROTECTED]> wrote: > Hi R users, > What is the fastest way to replace a(some) value(s) in a (numeric) > vector? > I checked ?replace, but its output is another vector. > 1) I wonder if there's any function to perform in-place

Re: [R] fast value replacement in (numeric) vector

2008-09-20 Thread Stefan Evert
On 20 Sep 2008, at 23:41, Ling, Gary (Electronic Trading) wrote: Hi R users, What is the fastest way to replace a(some) value(s) in a (numeric) vector? I checked ?replace, but its output is another vector. 1) I wonder if there's any function to perform in-place replacement? How about L[n] <-

[R] fast value replacement in (numeric) vector

2008-09-20 Thread Ling, Gary (Electronic Trading)
Hi R users, What is the fastest way to replace a(some) value(s) in a (numeric) vector? I checked ?replace, but its output is another vector. 1) I wonder if there's any function to perform in-place replacement? 2) Or any other function would do what I'm looking for with faster speed? # here is so

Re: [R] selecting from a series of integers with pre-determined probabilities

2008-09-20 Thread jim holtman
?sample efficient enough?> system.time(z <- sample(1:5, 50, TRUE, prob=c(.05,.05,.05,.05,.8))) user system elapsed 0.120.020.14 > table(z) z 1 2 3 4 5 24800 24771 25039 25022 400368 > On Sat, Sep 20, 2008 at 3:43 PM, John Sorkin <[EMAIL PROTECTED]>

[R] selecting from a series of integers with pre-determined probabilities

2008-09-20 Thread John Sorkin
R 2.6 Windows XP I need to select from the integers 1,2,3,4,5 with some pre-determined probability, e.g. probability of selecting 5 80%, probability of selecting 1 or 2 or 3 or 4 20%. Any suggestions for how I might accomplish this? I need to do it very efficiently as I will be doing it 500,0

Re: [R] fitting a hyperbole

2008-09-20 Thread stephen sefick
I am not sure if I am exaggerating or not read title as hyperbola On Sat, Sep 20, 2008 at 2:20 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > I have got a data set that is Gross Primary Productivity ~ Total > Suspended Solids it is a hyperbola just like: > plot(1/c(1:1000)) > > how do I model thi

[R] fitting a hyperbole

2008-09-20 Thread stephen sefick
I have got a data set that is Gross Primary Productivity ~ Total Suspended Solids it is a hyperbola just like: plot(1/c(1:1000)) how do I model this relationship so that I can get all of the neat things that lm gives residuals etc. etc. so that I can see if my eyeball model stands up. Thanks for

Re: [R] removing a word, the following space and the next word

2008-09-20 Thread jim holtman
> x <- 'Mr Jones ate lunch and Mr Smith was tied' > gsub('(Mr\\.*)\\s+\\w+', "\\1 ", x) [1] "Mr ate lunch and Mr was tied" > > On Sat, Sep 20, 2008 at 2:24 AM, Bob Green <[EMAIL PROTECTED]>wrote: > > Hello, >> > > I am hoping for advice as to how I could remove all words immediate

Re: [R] AUC / ROC for presence only.

2008-09-20 Thread Núria Roura Pascual
Dear Miltinho, Since you don´t have absence, I think that you cannot calculate the AUC. However, you can create pseudoabsences (by selecting areas from where you know that the species is not present) at random and use them as surrogates of absences data. This process has its drawbacks, which have

[R] multiple comparisons for MANOVA results

2008-09-20 Thread Wade Wall
Hi all, This is both a general and r specific question. I am analyzing some morphological data and have performed a MANOVA on the 5 groups with 5 measured morphological traits. The results provide me with some pairwise comparisons, but I would like to run a multiple comparison test on the result

[R] A Regression question

2008-09-20 Thread Ron Michael
Dear all, I have statistics related question. What type of modeling technique to be used when dependent variable (Y) is continuous but with 99% zero.The other 1% (+ve , don't have -ve values) values are huge. If I take DGP of dependent variable as Pareto type distribution, will it be ok? Your hel

Re: [R] Coloring spaces between lines in xyplot

2008-09-20 Thread Frank E Harrell Jr
Jim Lemon wrote: Seth W Bigelow wrote: Ok, thanks to Carl Witthoft I now know that to color spaces between and below a pair of lines in xyplot, I will need to redefine the lines as polygons, and use the lpolygon panel function, as in the following library(lattice) p <- c(1,10,10,1) # ve

Re: [R] lower and upper limits in integrate as vectors

2008-09-20 Thread Andreas Wittmann
dear baptiste, thank you very much, that was excatly what i was looking for:-) best regards Andreas baptiste auguie wrote: Hi, I think you want to Vectorize integrate(), not integrand(). Here's a way using mapply, integrand <- function(z) { return(z * z) } vec1<-1:3 vec2<-2:4 mapply

Re: [R] lower and upper limits in integrate as vectors

2008-09-20 Thread baptiste auguie
Hi, I think you want to Vectorize integrate(), not integrand(). Here's a way using mapply, integrand <- function(z) { return(z * z) } vec1<-1:3 vec2<-2:4 mapply(integrate, lower=vec1, upper=vec2, MoreArgs=list(f=integrand) ) baptiste On 20 Sep 2008, at 13:08, Andreas Wittmann wrote: D

[R] lower and upper limits in integrate as vectors

2008-09-20 Thread Andreas Wittmann
Dear R useRs, i try to integrate the following function for many values "integrand" <- function(z) { return(z * z) } i do this with a for-loop for(i in 2:4) { z <- integrate(integrand, i-1, i)$value cat("z", z, "\n") } to speed up the computation for many values i tried vectors in integrat

Re: [R] Computation of contour values - Speeding up computation

2008-09-20 Thread Andreas Wittmann
Thank you very much, yes maybe its worth working on it. best regards Andreas Uwe Ligges wrote: Andreas Wittmann wrote: Dear R useRs, i have the following code to compute values needed for a contour plot "myContour" <- functio

Re: [R] Coloring spaces between lines in xyplot

2008-09-20 Thread Jim Lemon
Seth W Bigelow wrote: Ok, thanks to Carl Witthoft I now know that to color spaces between and below a pair of lines in xyplot, I will need to redefine the lines as polygons, and use the lpolygon panel function, as in the following library(lattice) p <- c(1,10,10,1) # vector of x values q

Re: [R] Plot Accessibility

2008-09-20 Thread Jim Lemon
john crepezzi wrote: Is there any way to determine if a plot exists before running lines()? Hi John, I use : if(dev.cur()==1) which usually indicates that the current device is the null device, and therefore no plot windows are active. See the code for triax.plot. Jim _

[R] Error in GEE model fit

2008-09-20 Thread david dav
Hi, I would like to fit a GLM model with GEE on clustered data. I tried to use gee in the GEE package on a twin data set. All cluster are of size 2. I removed the missing data and ordered by IDENTIF2 first. library(gee) mod.pc <- gee(Y ~ X1 + X2 , id = IDENTIF2, family = binomial, corstr = "unstr

[R] gridBase and layout

2008-09-20 Thread baptiste auguie
Dear list, I have produced a fairly intricate plot arrangement for use in a publication using layout() and gridBase, and out of curiosity I'd like to learn whether a more elegant and robust solution could be obtained with grid to avoid the layout() function. library(gridBase) x <- seq(

Re: [R] Plot availability

2008-09-20 Thread john crepezzi
hadley, thanks for the example, that put it much better into perspective. I'm gonna make some coffee and read through this page and see how deep it goes. I might even be able to use this for some other things we're doing. Thanks! --John Crepezzi hadley wickham wrote: > I really would encourage