Re: [R] Extract Element of String with R's Regex

2008-07-31 Thread Simon Blomberg
How about: unlist(strsplit(x, split=" "))[c(4:5,10)] That perl script looks like a good reason to avoid perl. Simon. On Fri, 2008-08-01 at 15:13 +0900, Edward Wijaya wrote: > Hi, > > I have this string, in which I want to extract some of it's element: > > > x <- "Best-K Gene 11340 211952_at R

Re: [R] Remove Even Number from A Vector

2008-07-31 Thread Ferry
x[!(x %% 2 == 0)] On Thu, Jul 31, 2008 at 10:01 PM, Gundala Viswanath <[EMAIL PROTECTED]>wrote: > Dear all, > > How can I remove the even number from the following vector > > > x > [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 > 43 > [20] 44 50 74 75 82 84 89

Re: [R] cutting out numbers from vectors

2008-07-31 Thread Paul Roebuck
On Thu, 31 Jul 2008, calundergrad wrote: > i have a vector with values similar to the below text > [1] 001-010-001-0 > > I want to get rid of all leading zeroes. > for example i want to change the values of the vector > so that [1] 001-010-001-0 becomes [1] 1-010-001-0. > > Another example > [1]08

[R] Extract Element of String with R's Regex

2008-07-31 Thread Edward Wijaya
Hi, I have this string, in which I want to extract some of it's element: > x <- "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669 -965.35" yielding this array [1] "211952_at" "RANBP5" "2" In Perl we would do it this way: __BEGIN__ my @needed =(); my $str = "Best-K Gene 11340 21

Re: [R] Remove Even Number from A Vector

2008-07-31 Thread Paul Roebuck
On Fri, 1 Aug 2008, Gundala Viswanath wrote: > How can I remove the even number from the following vector > > > x > [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 > 43 > [20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 > 122 > [39] 123 13

Re: [R] cutting out numbers from vectors

2008-07-31 Thread Moshe Olshansky
Yes, this is how it should be done! --- On Fri, 1/8/08, Christos Hatzis <[EMAIL PROTECTED]> wrote: > From: Christos Hatzis <[EMAIL PROTECTED]> > Subject: Re: [R] cutting out numbers from vectors > To: "'calundergrad'" <[EMAIL PROTECTED]>, r-help@r-project.org > Received: Friday, 1 August, 2008,

[R] Remove Even Number from A Vector

2008-07-31 Thread Gundala Viswanath
Dear all, How can I remove the even number from the following vector > x [1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 43 [20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 122 [39] 123 135 136 157 158 yielding 5, 17, 21, 23, 25, . (k

[R] I install R in Ubuntu with apt-get, But I cannot see help.start() page.why

2008-07-31 Thread xiaopeng hu
I install R in Ubuntu with apt-get,But I cannot see help.start() page.why Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Moshe Olshansky
y <- 2 - (x[,1] > x[,2]) you can also do cbind(x,y) if you wish. --- On Fri, 1/8/08, Gundala Viswanath <[EMAIL PROTECTED]> wrote: > From: Gundala Viswanath <[EMAIL PROTECTED]> > Subject: [R] Grouping Index of Matrix Based on Certain Condition > To: [EMAIL PROTECTED] > Received: Friday, 1 Aug

Re: [R] cutting out numbers from vectors

2008-07-31 Thread Moshe Olshansky
This is something that is easier done in C than in R (to the best of my very limited knowledge). To do this in R you could do something like: > x <- "082-232-232-1" > y <-unlist(strsplit(x,"")) > i <- which(y != "0")[1]-1 > paste(y[-(1:i)],collapse="") [1] "82-232-232-1" --- On Fri, 1/8/08, c

Re: [R] Help with hazard plots

2008-07-31 Thread Marc Schwartz
on 07/31/2008 04:29 PM Alan Cox wrote: Hello. I am hoping someone will be willing to help me understand something about hazard plots created with muhaz(...). I have some background in statistics (minor in grad school), but I haven't been able to figure one thing about hazard plots. I am using

Re: [R] cutting out numbers from vectors

2008-07-31 Thread Christos Hatzis
Have a look at gsub: > x <- "001-010-001-0" > gsub("^0+", "", x) [1] "1-010-001-0" -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of calundergrad > Sent: Thursday, July 31, 2008 4:40 PM > To: r-help@r-project.org > Subject: [R] cutting ou

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Jorge Ivan Velez
Dear Gundala, Try this: x=as.matrix(read.table(textConnection(" 4.482909e-01 0.55170907 9.479594e-01 0.05204063 8.923553e-01 0.10764474 9.295003e-01 0.07049966 8.880434e-01 0.11195664 9.197367e-01 0.08026327 9.431232e-01 0.05687676 9.460356e-01 0.05396442 6.053829e-01 0.39461708 9.515173e-01 0.04

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

2008-07-31 Thread Rolf Turner
On 1/08/2008, at 2:56 PM, stephen sefick wrote: z <- rnorm(5000) f <- fft(z) d <- fft(f, inverse=T) plot(z, d) z <- rnorm(5000) z.ts <- ts(z) f <- fft(z.ts) d <- fft(f, inverse=T) plot(z.ts, d) temp <- matrix(c(1,4,2, 20), nrow=2) d <- fft(temp) f <- fft(d, inverse=T) plot(temp, f) this,

Re: [R] Survival statistics--displaying multiple plots

2008-07-31 Thread Gregory Pierce
Marc, Thank you so much! Your solution is perfect! I hadn't known about the "cut" function. The graph is precisely what I needed. I have the ISwR book but not anything more advanced. Need to get some more advanced books, maybe? I have been stubbornly working on this for a few hours now, and getti

Re: [R] Storing Matrices into Hash

2008-07-31 Thread Stephen Tucker
Hm didn't know about the abind package. That is pretty sweet. I do often opt for the 'list of matrices' myself though because I'm more familiar with the methods for lists... To answer one of Gundala's questions directly (assuming list of matrices is acceptable): Since you can do this, > x <-

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Christos Hatzis
Try this: > x <- matrix(runif(20), ncol=2) > x [,1] [,2] [1,] 0.33119833 0.4797847 [2,] 0.01339784 0.5218626 [3,] 0.78975940 0.8597246 [4,] 0.60849015 0.5217248 [5,] 0.91779777 0.9364047 [6,] 0.88302538 0.3467961 [7,] 0.87565986 0.4029147 [8,] 0.51594479 0.9885018 [9,] 0.

[R] Problem with RSPython

2008-07-31 Thread Ted Rosenbaum
I am very much a beginner at Python and am trying to get RSPython to work for me to solve a specific problem with geocoding addresses using the geopy library for Python (which appears to be an easy way to geocode large numbers of addresses). While I can load up the RSPython library just fine, when

[R] cutting out numbers from vectors

2008-07-31 Thread calundergrad
i have a vector with values similar to the below text [1] 001-010-001-0 I want to get rid of all leading zeroes. for example i want to change the values of the vector so that [1] 001-010-001-0 becomes [1] 1-010-001-0. Another example [1]082-232-232-1 becomes [1] 82-232-232-1 -- View this mes

Re: [R] Code to calculate internal rate of return

2008-07-31 Thread Moshe Olshansky
You can use uniroot (see ?uniroot). As an example, suppose you have a $100 bond which pays 3% every half year (6% coupon) and lasts for 4 years. Suppose that it now sells for $95. In such a case your time intervals are 0,0.5,1,...,4 and the payoffs are: -95,3,3,...,3,103. To find internal rate

[R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Gundala Viswanath
Hi, I have the following (M x N) matrix, where M = 10 and N =2 What I intend to do is to group index of (M) based on this condition of "x_mn" , namely For each M, If x_m1 > x_m2, assign index of M to Group1 otherwise assign index of M into Group 2 > x [,1] [,2] [1,] 4.482

Re: [R] Storing Matrices into Hash

2008-07-31 Thread Bert Gunter
R also has arrays (?array). If all the matrices are the **same dimension** and **same mode** (i.e. all numeric or all character), this is perhaps easier, especially if you want to access various "pieces" of your matrices. Given existing matrices, mat1, mat2,..., the slightly tricky way to combine

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

2008-07-31 Thread stephen sefick
z <- rnorm(5000) f <- fft(z) d <- fft(f, inverse=T) plot(z, d) z <- rnorm(5000) z.ts <- ts(z) f <- fft(z.ts) d <- fft(f, inverse=T) plot(z.ts, d) temp <- matrix(c(1,4,2, 20), nrow=2) d <- fft(temp) f <- fft(d, inverse=T) plot(temp, f) this, looks to me, to be the same. you have to take the

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

2008-07-31 Thread stephen sefick
z <- rnorm(5000) f <- fft(z) d <- fft(f, inverse=T) plot(z, d) z <- rnorm(5000) z.ts <- ts(z) f <- fft(z.ts) d <- fft(f, inverse=T) plot(z.ts, d) temp <- matrix(c(1,4,2, 20), nrow=2) d <- fft(temp) f <- fft(d, inverse=T) plot(temp, f) this, looks to me, to be the same. you have to take the

Re: [R] Storing Matrices into Hash

2008-07-31 Thread Erik Iverson
Gundala Viswanath wrote: Thanks so much Erik, But how do you include that in a loop. I tried this, doesn't seem to work. Please advice: __BEGIN__ all_mat <- NULL for (matno in 1:10) { mat <- process_to_create_matrix(da[matno]) all_mat <- list(all_post, matno = mat) } I'm not exac

Re: [R] Coarsening the Resolution of a Dataset

2008-07-31 Thread jim holtman
In the first case, 'crops' is an object that is 142MB in size, and that alone will take up almost 50% of your memory. You are also probably generating another object of like size in doing the operation. Can you cut down the size of the objects that you need. What operating system do you have and

Re: [R] Storing Matrices into Hash

2008-07-31 Thread Gundala Viswanath
Thanks so much Eric, But how do you include that in a loop. I tried this, doesn't seem to work. Please advice: __BEGIN__ all_mat <- NULL for (matno in 1:10) { mat <- process_to_create_matrix(da[matno]) all_mat <- list(all_post, matno = mat) } print(all_mat) # it gives funny structure

Re: [R] Storing Matrices into Hash

2008-07-31 Thread Erik Iverson
I think a named list is probably the easiest way to start off, something like: all_mat <- list(mat1 = mat1, mat2 = mat2) all_mat$mat2 Gundala Viswanath wrote: Hi, Suppose I have these two matrices (could be more). What I need to do is to store these matrices into a hash. So that I can cal

[R] Storing Matrices into Hash

2008-07-31 Thread Gundala Viswanath
Hi, Suppose I have these two matrices (could be more). What I need to do is to store these matrices into a hash. So that I can call back any of the matrix back later. Is there a way to do it? > mat_1 [,1][,2] [1,] 9.327924e-01 0.067207616 [2,] 9.869321e-01 0.013067929

[R] How to abort JGR

2008-07-31 Thread g-h-d
Hi, say I have a loop that cannot complete. how do I abort within JGR? I use unbuntu linux. Thanks. -- View this message in context: http://www.nabble.com/How-to-abort-JGR-tp18766719p18766719.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] sort rows of matrix by rows of another matrix

2008-07-31 Thread Steven McKinney
I came up with the same solution as Mark Leeds. > a1roworders <- t(apply(a1, 1, order)) > a2ord <- t(sapply(seq(nrow(a1)), function(x) a2[x, a1roworders[x,]] )) > a2ord [,1] [,2] [,3] [1,] 102 101 103 [2,] 102 101 103 [3,] 103 101 102 [4,] 101 102 103 Mark's question about the o

[R] P-I curve

2008-07-31 Thread Bruno P Masi
I am trying to write a function for P-I curve meansurament of Platt (1980). I used the exemple of nonlinear least squares in R-intro.pdf but I can't finish the analysis. Could you help me? Is there another way to do this analysis? Thanks. I<- c(0,0,100,100,200,200,500,500) P<- c(1.35,-1.41,10.

[R] clustering and data-mining...

2008-07-31 Thread losemind
Hi all, I am doing some experiment studies... It seems to me that with different combination of 5 parameters, the end results ultimately converged to two scalars. That's to say, some combinations of the 5 parameters lead to one end result and some other combinations of the 5 parameters lead to t

Re: [R] allocMatrix limits

2008-07-31 Thread Vadim Kutsyy
I am getting an error "allocMatrix: too many elements specified" when I am trying to create large matrix or vector (about 1 billion elements). How can I find out limits on allocMatrix? Can I increase them? ?"Memory-limits", and you cannot increase them unless you have a system which has lar

[R] multiple comparison

2008-07-31 Thread Agus Susanto
Dear all, I was trying to understand how "multcomp" package works by running the examples given in the documentation. However I still don't understand when it comes to multiple comparison set by user (please refer to "Ksub" in the code). Therefore I run 2 other cases along with the original examp

Re: [R] sort rows of matrix by rows of another matrix

2008-07-31 Thread markleeds
below is another way ( maybe the same ? )but with an extra line to make roworder. i'm also not clear on why I have to take the transpose of the result that comes back form the apply call. in ?apply, it says that the function tries to convert the result back to a matrix. that's fine but why doe

Re: [R] bwplot with Date object

2008-07-31 Thread Deepayan Sarkar
On Thu, Jul 31, 2008 at 12:54 PM, GOUACHE David <[EMAIL PROTECTED]> wrote: > Hello R-helpers, > > I would like to produce a boxplot for dates, using lattice. > > Here is a dummy example : > > dates<-as.Date(32768:32895,origin="1900-01-01") > plouf<-data.frame(days=dates,group=factor(rep(1:2,times=1

Re: [R] dput vs unclass to see what a factor really is composed of

2008-07-31 Thread Duncan Murdoch
On 31/07/2008 5:21 PM, Jacob Wegelin wrote: I used read.dta() to read in a Stata 9 dataset to R. The "Sex01" variable takes on two values in Stata: 0 and 1, and it is labeled "M" and "F" respectively, analogous to an R factor. Thus, read.dta reads it in as a factor. Now, I wanted to see what thi

Re: [R] sort rows of matrix by rows of another matrix

2008-07-31 Thread Johnson, Eric A. (Seattle)
If you're not adverse to cbind-ing a1 and a2, you can use this: a1a2 <- cbind(a1, a2) a3 <- t(apply(a1a2, 1, function(x) x[order(x[1:ncol(a1)])+ncol(a1)])) Eric -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Timothy W. Hilton Sent: Thursday, July 31,

Re: [R] instal tar.gz package on windows

2008-07-31 Thread Duncan Murdoch
On 31/07/2008 4:07 PM, georgiana onicescu wrote: Dear HelpeRs, I have created a tar.gz package (the package was created on unix) and I would like to install it in R on a Windows operating system. As far as I know, R in Windows accepts only packages in zip file for installation and I could not fi

Re: [R] dput vs unclass to see what a factor really is composed of

2008-07-31 Thread Prof Brian Ripley
See ?NumericConstants. On Thu, 31 Jul 2008, Jacob Wegelin wrote: I used read.dta() to read in a Stata 9 dataset to R. The "Sex01" variable takes on two values in Stata: 0 and 1, and it is labeled "M" and "F" respectively, analogous to an R factor. Thus, read.dta reads it in as a factor. Now, I

Re: [R] allocMatrix limits

2008-07-31 Thread Prof Brian Ripley
On Thu, 31 Jul 2008, Vadim Kutsyy wrote: I am getting an error "allocMatrix: too many elements specified" when I am trying to create large matrix or vector (about 1 billion elements). How can I find out limits on allocMatrix? Can I increase them? ?"Memory-limits", and you cannot increase the

Re: [R] Help with hazard plots

2008-07-31 Thread Alan Cox
I clicked "Send" before making sure I thanked anyone who took the time to help me out.  Sorry about that.  To all who read or respond: thanks!. - Original Message - From: "Alan Cox" <[EMAIL PROTECTED]> To: r-help@r-project.org Sent: Thursday, July 31, 2008 5:29:35 PM GMT -05:00 US/C

Re: [R] instal tar.gz package on windows

2008-07-31 Thread Stefan Evert
Dear HelpeRs, I have created a tar.gz package (the package was created on unix) and I would like to install it in R on a Windows operating system. As far as I know, R in Windows accepts only packages in zip file for installation and I could not find a way to install a tar.gz file. I would like

[R] dput vs unclass to see what a factor really is composed of

2008-07-31 Thread Jacob Wegelin
I used read.dta() to read in a Stata 9 dataset to R. The "Sex01" variable takes on two values in Stata: 0 and 1, and it is labeled "M" and "F" respectively, analogous to an R factor. Thus, read.dta reads it in as a factor. Now, I wanted to see what this variable *really* is, in R. For instance, so

Re: [R] rollapply() to portions of a matrix

2008-07-31 Thread Gabor Grothendieck
rollapply over an index. Modify this appropriately: > z <- zoo(101:109, 11:19) > f <- function(ix) if (ix[1] < 5) min(z[ix]) else max(z[ix]) > rollapply(zoo(seq_along(z)), 3, by = 3, f) 2 5 8 101 104 109 On Thu, Jul 31, 2008 at 3:36 PM, rcoder <[EMAIL PROTECTED]> wrote: > > Hi everyone, >

[R] Help with hazard plots

2008-07-31 Thread Alan Cox
Hello.  I am hoping someone will be willing to help me understand something about hazard plots created with muhaz(...).  I have some background in statistics (minor in grad school), but I haven't been able to figure one thing about hazard plots.  I am using hazard plots to track customer cancell

[R] sort rows of matrix by rows of another matrix

2008-07-31 Thread Timothy W. Hilton
Hello all, I am trying to sort rows of one matrix by rows of another. Given a1 and a2: -- > a1 [,1] [,2] [,3] [1,]768 [2,]424 [3,]472 [4,]038 a1 <- structure(c(7, 4, 4, 0, 6, 2, 7, 3, 8, 4, 2, 8), .Dim = c(4L, 3L)) > a2 [,1] [,2] [,

[R] anisotropy in vgm model. HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2008-07-31 Thread Alessandro
Hi All, I have this problem. I don’t understand the right code in R when I have an anisotropy in the semivariogram model plot(variogram(Z~1, subground, cutoff=1800, width=80, alpha=c(45, 135, 90, 135))) I have a good model in 90° and eventually in 90° and 45° v = variogram(Z~1, sub

[R] allocMatrix limits

2008-07-31 Thread Vadim Kutsyy
I am getting an error "allocMatrix: too many elements specified" when I am trying to create large matrix or vector (about 1 billion elements). How can I find out limits on allocMatrix? Can I increase them? Thanks, Vadim. PS: I am running R on SUSE10 on ___

Re: [R] 'system' command through Rserve

2008-07-31 Thread Jeffrey Horner
This probably has to do with your ssh configuration and nothing to do with R. How are you starting Rserve? Is it run with the same user privileges as when you run R manually? Best, Jeff Patil, Prasad wrote on 07/31/2008 02:51 PM: Hello, I've installed an Rserve instance on a remote serv

Re: [R] strip names lattice graphics

2008-07-31 Thread Deepayan Sarkar
On Thu, Jul 31, 2008 at 1:30 PM, GOUACHE David <[EMAIL PROTECTED]> wrote: > R-helpers, > > I'm having difficulty with customizing strip names for a lattice graphic. > > Here is an example using the iris data set : > > xyplot(Sepal.Length+Sepal.Width~Petal.Length,groups=Species,data=iris) > > ## I'd

Re: [R] Problem with the installation of "install R" on Sun Solaris

2008-07-31 Thread Prof Brian Ripley
You are missing 'ranlib': take a closer look at the output from configure (and the posting guide). My guess is that either /usr/ccs/bin is not in your path or you don't have the tools installed to build applications. This is not an R issue, and you need to seek local Solaris help. On Thu, 3 M

Re: [R] instal tar.gz package on windows

2008-07-31 Thread Marc Schwartz
on 07/31/2008 03:07 PM georgiana onicescu wrote: Dear HelpeRs, I have created a tar.gz package (the package was created on unix) and I would like to install it in R on a Windows operating system. As far as I know, R in Windows accepts only packages in zip file for installation and I could not fin

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

2008-07-31 Thread Li Li
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 > fft(temp,inverse=T) [,1] [,2] [1,] 27+0i -

Re: [R] History pruning

2008-07-31 Thread hadley wickham
> It's not really equivalent, natural language has ambiguities and subtleties > that computer languages, especially functional languages, intentionally > don't have. By their nature, computer languages can be turned into parse > trees unambiguously and then those trees can be manipulated. But in

Re: [R] Coarsening the Resolution of a Dataset

2008-07-31 Thread Steve Murray
Please find below my command inputs, subsequent outputs and errors that I've been receiving. > crops <- read.table("crop2000AD.asc", colClasses = "numeric", na="-") > str(crops[1:10]) 'data.frame': 2160 obs. of 10 variables: $ V1 : num NA NA NA NA NA NA NA NA NA NA ... $ V2 : num NA N

Re: [R] upgrade to 2.5

2008-07-31 Thread Gabor Grothendieck
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 to install all the packages again? > > Thanks > > Jason > > > > You may find the following

Re: [R] Randomly drawing observations from factors.

2008-07-31 Thread Marc Schwartz
on 07/31/2008 03:20 PM Economics Guy wrote: I have a large data set where one of the columns needs be a unique identifier (ID) for each row. However for a few of the rows they have the same ID. What I need to do is randomly draw one of the rows and keep it in the data frame and drop all the other

[R] strip names lattice graphics

2008-07-31 Thread GOUACHE David
R-helpers, I'm having difficulty with customizing strip names for a lattice graphic. Here is an example using the iris data set : xyplot(Sepal.Length+Sepal.Width~Petal.Length,groups=Species,data=iris) ## I'd like to change the 2 strip names to "Length" and "Width" for example, this is what

[R] instal tar.gz package on windows

2008-07-31 Thread georgiana onicescu
Dear HelpeRs, I have created a tar.gz package (the package was created on unix) and I would like to install it in R on a Windows operating system. As far as I know, R in Windows accepts only packages in zip file for installation and I could not find a way to install a tar.gz file. I would like

Re: [R] Query about finding correlations

2008-07-31 Thread Stefan Grosse
How about making your homeworks yourselfes? lalitha viswanath wrote: > Hi > I have a dataframe which has 3 columns of numeric data > A,B,C each of which has been obtained independent of > the other. > > We are trying to find out, which of A or B cause C > i.e. We are hypothesising that C is the ef

Re: [R] reference in article

2008-07-31 Thread Peter Dalgaard
Tomas Mikoviny wrote:> Hi all R positive,>> does anyone know how to refer R in article?>> thanks>> tomas> Like this (well, almost! This is from R 2.4.1 - 2007 on the most recentversion) > citation() To cite R in publications use: R Development Core Team (2006). R: A language and environment

Re: [R] History pruning

2008-07-31 Thread Ken Williams
On 7/31/08 2:12 PM, "Duncan Murdoch" <[EMAIL PROTECTED]> wrote: > > expression() returns a list of language objects, and we only asked for > one. We can look inside it: Hey, cool. Now let me see if I can do anything useful with that. Thanks. -Ken -- Ken Williams Research Scientist The

[R] rollapply() to portions of a matrix

2008-07-31 Thread rcoder
Hi everyone, I have a rollapply statement that applies a function, in steps, over a data matrix as follows: #Code start testm<-rollapply(mat, 100, by=100, min, na.rm=F) #Code end This moves down matrix 'mat' and calculates the minimum value over a 100 row range, every 100 rows (i.e. no overlaps

Re: [R] upgrade to 2.5

2008-07-31 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. http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359

[R] Randomly drawing observations from factors.

2008-07-31 Thread Economics Guy
I have a large data set where one of the columns needs be a unique identifier (ID) for each row. However for a few of the rows they have the same ID. What I need to do is randomly draw one of the rows and keep it in the data frame and drop all the others which have the same ID. For example: v1 <-

Re: [R] Query about finding correlations

2008-07-31 Thread Stefan Grosse
I am sorry if I misinterpreted this but this questions looks/looked very like a very basic one about statistical inference... (have a look at the Manuals/contributed documentation e.g. Faraway) Lalitha Viswanath wrote: > Hi > This is not a homework assignment :) > Me and my manager are trying to u

[R] vertical bpplot

2008-07-31 Thread GOUACHE David
Hello all, I have a question on bpplot (or more specifically panel.bpplot used with bwplot) from package Hmisc. I would like to produce a box-percentile plot but vertically. And I hqve not been able to use the horizontal argument... using one of the examples from ?panel.bpplot : bwplot(g ~

[R] bwplot with Date object

2008-07-31 Thread GOUACHE David
Hello R-helpers, I would like to produce a boxplot for dates, using lattice. Here is a dummy example : dates<-as.Date(32768:32895,origin="1900-01-01") plouf<-data.frame(days=dates,group=factor(rep(1:2,times=128/2))) bwplot(group~days,data=plouf) # doesn't work, whereas : bwplot(group~as.num

[R] 'system' command through Rserve

2008-07-31 Thread Patil, Prasad
Hello, I've installed an Rserve instance on a remote server. I have no problem interfacing with it and running most commands. I have loaded some R scripts on the remote server, and one of them contains a system command to copy a file (created by the script) onto another server. When I run the s

Re: [R] History pruning

2008-07-31 Thread Duncan Murdoch
On 7/31/2008 2:08 PM, Ken Williams wrote: On 7/31/08 11:01 AM, "hadley wickham" <[EMAIL PROTECTED]> wrote: I think that would be a very hard task - Well, at least medium-hard. But I think significant automatic steps could be made, and then a human can take over for the last few steps. Tha

Re: [R] How to output R image to a file?

2008-07-31 Thread Aiste Aistike
Hi, Thank everyone for you help. I got my histogram written to a file. Thanks once again. Aiste 2008/7/31 Jian Zhang <[EMAIL PROTECTED]> > Hi aiste, > two easy example produce mypic.ps or mypic.pdf for you x<-rnorm(50) > postscript("mypic.ps") > hist(x) > dev.off() > pdf( mypic.pdf) >

Re: [R] Random number generation

2008-07-31 Thread Max
This is perfect, thanks! :) Jorge Ivan Velez pretended : Hi Max, See ?write.table. Perhaps: MAT <- matrix(runif(1 * 6), 1, 6) # TXT format write.table(MAT, "C:/yourmatrix.txt",col.names=FALSE,row.names=FALSE,quote=FALSE) # XLS format write.table(MAT, "C:/yourmatrix.xls",col.names=FA

Re: [R] How to output R image to a file?

2008-07-31 Thread Erik Iverson
?Devices for a start. Aiste Aistike wrote: Hello, I would like to ask if anyone could help me. I want to save images I create (e.g. histograms, boxplots, plots, etc.) to a file or files. Does anyone know how to do this? Thank you. Aiste [[alternative HTML version deleted]] _

Re: [R] Re gression between adjacent columns - error with NAs

2008-07-31 Thread rcoder
Thank you both very much for your assistance. Both the suggestions worked out in the end, and I managed to achieve what I wanted. There is something else I want to try, which is a slight deviation on the theme. In the code I posted, I export Intercept and Slope regression coefficients to an o/p m

Re: [R] History pruning

2008-07-31 Thread Ken Williams
On 7/31/08 11:01 AM, "hadley wickham" <[EMAIL PROTECTED]> wrote: > I think that would be a very hard task - Well, at least medium-hard. But I think significant automatic steps could be made, and then a human can take over for the last few steps. That's why I was enquiring about "tools" rathe

Re: [R] Random number generation

2008-07-31 Thread David Barron
m <- runif(6) mm <- matrix(m, ncol=6) HTH Dave On Thu, Jul 31, 2008 at 6:24 PM, Max <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I did a quick search of the list and it looks like this may not have been > asked before... I'm trying to generate a matrix of random numbers between 0 > and 1,

Re: [R] Create an R package

2008-07-31 Thread FScottDahlgren
Thanks so much for the link. Scott Gabor Grothendieck wrote: > > Vista works fine for developing packages. You might look at > > http://batchfiles.googlecode.com > > which has some batch files for use with Vista and R. > > On Thu, Jul 24, 2008 at 9:13 PM, FScottDahlgren <[EMAIL PROTECTED]>

[R] How to output R image to a file?

2008-07-31 Thread Aiste Aistike
Hello, I would like to ask if anyone could help me. I want to save images I create (e.g. histograms, boxplots, plots, etc.) to a file or files. Does anyone know how to do this? Thank you. Aiste [[alternative HTML version deleted]] __ R-help@r

[R] anisotrophy in fit.variogram problem

2008-07-31 Thread Alessandro
Hi All, I wish to create a directional variograms at (0, 45, 90, 135) degrees from north (y-axis). v = variogram(Z~1, subground, cutoff=1800, width=80, alpha=c(0, 45, 90, 135)) 90 and 45 deg. look good but I don't understand in the fit.variogram how to create a ansi=c(X) with 90 an

Re: [R] Random number generation

2008-07-31 Thread Patrizio Frederic
?write.table could help PF 2008/7/31 Max <[EMAIL PROTECTED]>: > Marc, > > this is very handy. My next question is, do you know a quick and easy way to > transfer all of the output to a txt file? (or .xls)? > > Thanks, > > -Max > > > Marc Schwartz explained on 07/31/2008 : >> >> on 07/31/2008 12:

Re: [R] Random number generation

2008-07-31 Thread Jorge Ivan Velez
Hi Max, See ?write.table. Perhaps: MAT <- matrix(runif(1 * 6), 1, 6) # TXT format write.table(MAT, "C:/yourmatrix.txt",col.names=FALSE,row.names=FALSE,quote=FALSE) # XLS format write.table(MAT, "C:/yourmatrix.xls",col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t") HTH, Jorge On

Re: [R] Sampling two exponentials

2008-07-31 Thread Zhang Yanwei - Princeton-MRAm
I am trying to do this using the copula library and find a possible way out. library(copula) x=mvdc(claytonCopula(.75),c("exp","exp"),list(list(rate=1),list(rate=2))) x.sample=rmvdc(x,100) The above code gives a sample with two marginal exponential ditributions. But what does the first argument

Re: [R] Random number generation

2008-07-31 Thread Max
Marc, this is very handy. My next question is, do you know a quick and easy way to transfer all of the output to a txt file? (or .xls)? Thanks, -Max Marc Schwartz explained on 07/31/2008 : on 07/31/2008 12:24 PM Max wrote: Hi Everyone, I did a quick search of the list and it looks like t

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-31 Thread Michal Figurski
Gustaf, Summarizing things I don't understand: - Honestly, I was thinking I can use bootstrap to obtain better estimate of a mean - provided that I want it. So, I can't? - If I can't obtain reliable estimates of CI and variance from a small dataset, but I can do it with bootstrap - isn't it a "

Re: [R] Random number generation

2008-07-31 Thread Marc Schwartz
on 07/31/2008 12:24 PM Max wrote: Hi Everyone, I did a quick search of the list and it looks like this may not have been asked before... I'm trying to generate a matrix of random numbers between 0 and 1, with 6 columns, 1 rows. About all I know is that runif(1) gives me the random number

[R] Random number generation

2008-07-31 Thread Max
Hi Everyone, I did a quick search of the list and it looks like this may not have been asked before... I'm trying to generate a matrix of random numbers between 0 and 1, with 6 columns, 1 rows. About all I know is that runif(1) gives me the random number I'm looking for. Any help would b

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-31 Thread Mark Difford
Hi Michal, >> It is that you just don't estimate mean, or CI, or variance on PK profile >> data! >> It is as if you were trying to estimate mean, CI and variance of a >> "Toccata_&_Fugue_in_D_minor.wav" file. What for? The point is in the >> music! >> Would the mean or CI or variance tell you

Re: [R] Identifying common prefixes from a vector of words, and delete those prefixes

2008-07-31 Thread Christos Hatzis
A more general solution: strip.fun <- function(x, split=".") { xx <- strsplit(x, split, fixed=TRUE) txx <- table(unlist(xx)) nxx <- names(txx)[txx > 1] setdiff(unlist(xx), nxx) } > x <- c("dog.is.an.animal", "cat.is.an.animal", "rat.is.an.animal") > strip.fun(x) [1

Re: [R] Identifying common prefixes from a vector of words, and delete those prefixes

2008-07-31 Thread John Kane
There MUST be a better way but this will work. x <- c("dog.is.an.animal", "cat.is.an.animal", "rat.is.an.animal") bb <- strsplit(x, "\\.") myfun <- function(m) m[1] animals <- unlist(lapply(bb, myfun)) animals --- On Thu, 7/31/08, Daren Tan <[EMAIL PROTECTED]> wrote: > From: Daren Tan <[EMA

Re: [R] question about krige code in R

2008-07-31 Thread Roger Bivand
Alessandro unifi.it> writes: > > Hi All, > > I have this question. I wish to create a kriging map with R but I haven't a > auxiliary map. I have only one txt file with X, Y and Z records. > > When I use this code: > ... > subground.ok <- krige (Z~sqrt(X+Y), subground, subground.ovgm, nmax=4

[R] Sperman Correlation with rcorr (Hmisc)

2008-07-31 Thread Birgitle
Hello R-User! I have a data.frame with 82 variables (columns) and 290 rows. The variables are set to classes factor, ordered factor and numeric. I used the following code Matrix.My.data<-as.matrix(Df.My.Data[2:82]) Matrix.My.data.rcorr<-rcorr(Matrix.My.data, type="spearman") and got the foll

[R] Code to calculate internal rate of return

2008-07-31 Thread Thomas E
Hi all. I am an R newbie and trying to grasp how the simple optimization routines in R work. Specifically, I would like some guidance on how to set up a code to calculate the internal rate of return on an investment project (http://en.wikipedia.org/wiki/Internal_rate_of_return). My main problem

Re: [R] History pruning

2008-07-31 Thread Marc Schwartz
on 07/31/2008 08:35 AM Ken Williams wrote: On 7/30/08 1:59 PM, "Marc Schwartz" <[EMAIL PROTECTED]> wrote: I (and many others) use ESS (Emacs Speaks Statistics), in which case, I have an R source buffer in the upper frame and an R session in the lower frame. I also use ESS to edit my R code

Re: [R] odds ratios in multiway tables (stratified)

2008-07-31 Thread Marc Schwartz
on 07/31/2008 07:40 AM Wim Bertels wrote: On Wed, 2008-07-30 at 12:13 -0500, Marc Schwartz wrote: on 07/30/2008 08:48 AM Wim Bertels wrote: Hi, does anyone know of a function to calculate odds ratios in multiway tables (stratified) (+ the other usual statistics involved) i mean: say we have a

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-31 Thread Gustaf Rydevik
On Thu, Jul 31, 2008 at 4:30 PM, Michal Figurski <[EMAIL PROTECTED]> wrote: > Frank and all, > > The point you were looking for was in a page that was linked from the > referenced page - I apologize for confusion. Please take a look at the two > last paragraphs here: > http://people.revoledu.com/ka

Re: [R] tensor product of equi-spaced B-splines in the unit square

2008-07-31 Thread Patrizio Frederic
dear all, I apologize for a second post on the same subject. I still have the problem. I'm going to describe the problem in a different setting: I have 3 matrix A,B,W such that dim(A) = c(n,M) dim(B) = c(n,M) dim(W) = c(M,M) what I'm searching for is an efficient computation of vector R, length(R

Re: [R] stats question

2008-07-31 Thread Iasonas Lamprianou
Amazing responses to ,y question, and very fast, thanks all of you!  Dr. Iasonas Lamprianou Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 [EMAIL PROTECTED] - Original Message From: Marc Schwartz <[EMAIL PROTECTED]> To: [E

Re: [R] Significance of confidence intervals in the Non-Linear Least Squares Program.

2008-07-31 Thread bbouling
Dear Pf. Ripley, I use the nls() function coupled with the confint() to obtain the confidence interval of assessed parameters of fitting model. I don't understand why the confidence intervals estimated with such a method aren't consistent? Regards B. Boulinguiez Ph.D. in Chemistry Ecole Nation

  1   2   >