[R] x[order(x)] vs sort(x)?

2008-08-21 Thread Rory.WINSTON
Hi I have a question (which may be an obvious one). It is about an idiom which I have seen quite often: o <- order(x); <- x[o] vs. the alternative x <- sort(x) I am just wondering as to the rationale behind the order/reindex idiom vs sorting. Especially as there seems to be a marked performa

Re: [R] Large data sets with R (binding to hadoop available?)

2008-08-22 Thread Rory.WINSTON
Hi Apart from database interfaces such as sqldf which Gabor has mentioned, there are also packages specifically for handling large data: see the "ff" package, for instance. I am currently playing with parallelizing R computations via Hadoop. I haven't looked at PIG yet though. Rory -Ori

Re: [R] call perl

2008-08-22 Thread Rory.WINSTON
Maybe ?system Might be what you need here? -Rory -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jay an Sent: 22 August 2008 03:08 To: r-help@r-project.org Subject: [R] call perl Hi, It may be the old question. can anyone tell me how to call perl in

Re: [R] Odd behavior in histogram breaks?

2008-08-27 Thread Rory.WINSTON
I think the answer is in this line in hist.default(): breaks <- pretty(range(x), n = breaks, min.n = 1) > length(pretty(c(1:1000), 100)) [1] 101 > length(pretty(c(1:1000), 200)) [1] 201 > length(pretty(c(1:1000), 250)) [1] 201 > length(pretty(c(1:1000), 300)) [1] 201 > length(pretty(c(1:1000),

Re: [R] receiving "Error: cannot allocate vector of size 1.5 Gb"

2008-09-02 Thread Rory.WINSTON
See http://cran.r-project.org/bin/windows/base/rw-FAQ.html#There-seems-to-be-a-limit-on-the-memory-it-uses_0021 Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hayes, Daniel Sent: 02 Sep

[R] Extracting subsets by factor level?

2008-09-17 Thread Rory.WINSTON
Hi I have a data frame which looks like the following (it is a table of commit logs to a source repo). The Author column is treated as a factor, by virtue of stringsAsFactors being set to TRUE, so I can extract the number of commits per author by using table(logs$Author). Is there an elegant wa

Re: [R] Spectrum of a kernel

2008-09-18 Thread Rory.WINSTON
Maybe something like: k <- kernel(...) spectrum(c(rev(k$coef),k$coef)) Since the kernel is symmetric? Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 17 September

Re: [R] R-2.7.2 infected?

2008-09-23 Thread Rory.WINSTON
>could this be an intentional attack to compromise a very popular download, and >infect thousands of people.what could be the motivations...i hope its not >some corporate thug here No. False positives are relatively common. What exactly does the Win32/Adclicker.JO trojan do ??? Ajay www.

Re: [R] nnet support

2008-09-25 Thread Rory.WINSTON
The book "Modern Applied Statistics in S-Plus" has a section on using the nnet package. I believe it was originally created by the authors of the book. There are some other bits of literature with nnet examples, for instance www.liaad.up.pt/~ltorgo/DataMiningWithR/. HTH Rory -Original Me

Re: [R] [R-SIG-Finance] forecasting earnings, sales and gross margin of a company...

2008-10-23 Thread Rory.WINSTON
Dealing with accounting data is, in statistical terms, an ill-posed problem - there is not much data and quite a few dimensions. That said, there is a lot of research out there on applying statistical techniques to accounting data for the purposes of prediction and classification. But most predi

Re: [R] Extracting diagonal matrix

2008-11-21 Thread Rory.WINSTON
Try ?diag Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil Sent: 21 November 2008 12:28 To: r-help@r-project.org Subject: [R] Extracting diagonal matrix Dear All, I have a corre

[R] Calculating sum of letter values

2008-11-24 Thread Rory.WINSTON
Hi all If I have a string, say "ABCDA", and I want to convert this to the sum of the letter values, e.g. A -> 1 B -> 2 etc, so "ABCDA" = 1+2+3+4+1 = 11 Is there an elegant way to do this? Trying something like which(LETTERS %in% unlist(strsplit("ABCDA", ""))) is not quite correct, as it does

Re: [R] Calculating sum of letter values

2008-11-24 Thread Rory.WINSTON
Hi Mark Thanks, that's almost exactly what I need...theres just a slight difference with my requirement, in that I am looking for the actual index value in the alphabetical sequence, so that instead of: as.numeric(factor(unlist(strsplit("XYZ","" [1] 1 2 3 I would expect to see [1] 24 25 2

Re: [R] Calculating sum of letter values

2008-11-24 Thread Rory.WINSTON
Thanks a lot for the solutions everyone...really appreciated. Cheers Rory Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: Marc Schwartz [mailto:[EMAIL PROTECTED] Sent: 24 November 2008 15:24 To: WINSTON, Rory, GBM Cc: r-help@r-project.org Subje

[R] Line color based on data values?

2008-11-25 Thread Rory.WINSTON
Hi all Does anyone know if it is possible when plotting a line or scatter plot, to selectively color the data points based on the data value? i.e. if plotting say the percentage change in stock price movements, to color +ve points in green and -ve points in red? And extending this to a user-def

Re: [R] Can't load Rgraphviz on windows-based R

2008-12-02 Thread Rory.WINSTON
You can get LoadLibrary failures if a dependency is not found (e.g. a required dll or shlib used by the dll that you are explicitly loading). So make sure that all necessary dependencies (e.g. graphviz libs) are available in the system path. Rory Rory Winston RBS Global Banking & Markets Offi

[R] TreeMap Graphs

2008-12-04 Thread Rory.WINSTON
Hi all Is there an R package that enables me to generate "squarified treemap" plots? Thanks Rory Rory Winston RBS Global Banking & Markets 280 Bishopsgate, London, EC2M 4RB Office: +44 20 7085 4476 *** The Royal

[R] Lexical Permutation Algorithm in R

2008-12-05 Thread Rory.WINSTON
Hi all Here is a rather naive implementation of the SEPA algorithm for generating lexical permutations: lexperm3 <- function(x, n=length(x)) { perms <- list() k <- 1 perms[[k]] <- x k <- k + 1 for (y in 1:(factorial(n)-1)) { i <- n-1 while (x[i] > x[i+1] && i > 0) { i <- i - 1 }

[R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
Hi all (I'm sure this question has been asked before, but I cant find it). If I have two character vectors: > x <- c("aaa","bbb","ccc") > y <- c("1","2","3") How can I get the cartesian product of the string values? > expand.grid(x,y) Gives me a data frame with separate columns...however, I c

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
Hi David Perfect - if I specify sep="", it gives me exactly what I need. Cheers Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: David Winsemius [mailto:[EMAIL PROTECTED] Sent: 05 December 2008 14:16 To: WINSTON, Rory, GBM Cc: r-help@r-projec

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
Sorry, I spoke too soon... interaction() only works for sequences of equal length. Anyone know a method that works with unequal-length vectors? Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Beh

Re: [R] Cartesian Product Of Character Vectors

2008-12-05 Thread Rory.WINSTON
Got it...I completely overlooked the collapse argument to paste(): apply(expand.grid(x,y),1,function(x) paste(x,collapse="")) Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: WINSTON, Rory, GBM Sent: 05 December 2008 14:30 To: WINSTON, Rory, G

Re: [R] Downloading Reuters data from R

2008-12-11 Thread Rory.WINSTON
Hi Shubha I have created an extension DLL for downloading time series data from Reuters. You can download it from here: http://www.theresearchkitchen.com/blog/archives/287 There is also a short manual available at the same location: http://www.theresearchkitchen.com/blog/wp-content/uploads/200

Re: [R] very long integers

2008-12-11 Thread Rory.WINSTON
Have you looked at the R interface to gmp? http://cran.r-project.org/web/packages/gmp/index.html Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Robotham Sent: 11 December 2008 17:

Re: [R] Downloading Reuters data from R

2008-12-12 Thread Rory.WINSTON
Shubha I suspect it may be because it cannot find a dependent DLL. I'll email you off-list and we can work through it. Cheers Rory Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: Shubha Vishwanath Karanth [mailto:shub...@ambaresearch.com] Se