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]
Sent: 12 December 2008 11:29
To: WINSTON, Rory, GBM; r-h...@stat.math.ethz.ch
Subject: RE: Downloading Reuters data from R

Thank you very much for this. But since I don't know much of DLL, I am kind of 
a stuck with how to proceed with 'reuters_ts1.zip'. This zip file contains the 
'reuters_ts.dll' file.

dyn.load(reuters_ts.dll) generates the error,

 dyn.load(Z:\\reuters_ts1\\package\\reuters_ts.dll)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library 'C:/Documents and
Settings/shubhak/reuters_ts1/package/reuters_ts.dll':
  LoadLibrary failure:  This application has failed to start because the 
application configuration is incorrect. Reinstalling the application may fix 
this problem.

Where should the 'reuters_ts1.zip' to be stored? And how can I access 
'reuters_ts.dll' file for my use? Even checked ?dyn.load, but a bit confused. 
How do we use this?

I am sorry, if this troubles. Mine is a Windows XP Config.


Thanks again,
Shubha


-Original Message-
From: rory.wins...@rbs.com [mailto:rory.wins...@rbs.com]
Sent: Thursday, December 11, 2008 9:44 PM
To: Shubha Vishwanath Karanth; r-h...@stat.math.ethz.ch
Subject: RE: Downloading Reuters data from R

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/2008/12/intro.
pdf

I am currently in the process of uploading a separate extension DLL for 
retrieval of real-time data from Reuters.

Thanks
Rory


Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Shubha Vishwanath Karanth
Sent: 11 December 2008 07:41
To: r-h...@stat.math.ethz.ch
Subject: [R] Downloading Reuters data from R

Hi R,



Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in 
this? Or otherwise, is there a way to extract daily closing prices data of 
Reuters from R?





Thank you very much,

Shubha

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


***
The Royal Bank of Scotland plc. Registered in Scotland No 90312.
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority

This e-mail message is confidential and for use by the a...{{dropped:30}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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/2008/12/intro.pdf

I am currently in the process of uploading a separate extension DLL for 
retrieval of real-time data from Reuters.

Thanks
Rory


Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha 
Vishwanath Karanth
Sent: 11 December 2008 07:41
To: [EMAIL PROTECTED]
Subject: [R] Downloading Reuters data from R

Hi R,



Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in 
this? Or otherwise, is there a way to extract daily closing prices data of 
Reuters from R?





Thank you very much,

Shubha

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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:07
To: r-help@r-project.org
Subject: [R] very long integers

A quick question really:

I have a database with extremely long integer IDs (eg 588848900971299297), 
which is too big for R to cope with internally (it appears to store as a 
double), and when I do any frequency tables erroneous results appear. Does 
anyone know of a package that extends internal storage up to LONG, or is the 
only solution to read it in as a character from the original data?

In case anyone is curious, I didn't create the IDs, and in some form I must 
conserve all of the ID information for later use.

Thanks,

Aaron

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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
  }

  # i is largest index st x[i]  x[i+1]
  j - n

  # find min{ x[j], st n=j=i+1 and x[j]x[i] }
  while (x[j] = x[i]  j  i) {
   j - j - 1
  }

  # swap x[i] and x[j]
  tmp - x[i];x[i] - x[j]; x[j] - tmp

  # now sort everything from x[i+1]..x[n]
  # by reversing the elements within
  p - i + 1
  q - n
  while (p  q) {
   tmp - x[p]; x[p] - x[q]; x[q] - tmp
   p - p + 1
   q - q - 1
  }

  perms[[k]] - x
  k - k + 1
 }

 perms
}


This, as you can imagine, is severely slow. I would like to speed up this 
function if possible, which I guess would involve vectorizing the inner 
loop..does anyone have any ideas about how to improve this code's runtime?

One small potential optimization I tried was to shorten the sort by reverse 
ordering near the end of the inner loop : I tried replacing it with rev() and 
sort(decreasing=TRUE) over a partial subset of the x vector: however rev() was 
much slower, and I dont think sort() supports lexicographic ordering, so that 
didnt work.

Thanks
rory

Rory Winston
RBS Global Banking  Markets
280 Bishopsgate, London, EC2M 4RB
Office: +44 20 7085 4476



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 cant seem to get 
*apply to paste the column values together.

Thanks
Rory

Rory Winston
RBS Global Banking  Markets
280 Bishopsgate, London, EC2M 4RB
Office: +44 20 7085 4476



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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-project.org
Subject: Re: [R] Cartesian Product Of Character Vectors

Does this satisfy?

levels(interaction(x,y))
[1] aaa.1 bbb.1 ccc.1 aaa.2 bbb.2 ccc.2 aaa.3 bbb.3
ccc.3

--
David Winsemius


On Dec 5, 2008, at 8:12 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 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 cant seem to
 get *apply to paste the column values together.

 Thanks
 Rory

 Rory Winston
 RBS Global Banking  Markets
 280 Bishopsgate, London, EC2M 4RB
 Office: +44 20 7085 4476



 **
 * The Royal Bank of Scotland plc. Registered in Scotland
 No 90312.
 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorised and regulated by the Financial Services Authority

 This e-mail message is confidential and for use by the=2...{{dropped:
 25}}

 __
 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/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 Behalf Of WINSTON, Rory, 
GBM
Sent: 05 December 2008 14:20
To: [EMAIL PROTECTED]
Cc: r-help@r-project.org
Subject: Re: [R] Cartesian Product Of Character Vectors

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-project.org
Subject: Re: [R] Cartesian Product Of Character Vectors

Does this satisfy?

levels(interaction(x,y))
[1] aaa.1 bbb.1 ccc.1 aaa.2 bbb.2 ccc.2 aaa.3 bbb.3
ccc.3

--
David Winsemius


On Dec 5, 2008, at 8:12 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 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 cant seem to
 get *apply to paste the column values together.

 Thanks
 Rory

 Rory Winston
 RBS Global Banking  Markets
 280 Bishopsgate, London, EC2M 4RB
 Office: +44 20 7085 4476



 **
 * The Royal Bank of Scotland plc. Registered in Scotland
 No 90312.
 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorised and regulated by the Financial Services Authority

 This e-mail message is confidential and for use by the=2...{{dropped:
 25}}

 __
 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/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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, GBM; [EMAIL PROTECTED]
Cc: r-help@r-project.org
Subject: RE: [R] Cartesian Product Of Character Vectors

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 Behalf Of WINSTON, Rory, 
GBM
Sent: 05 December 2008 14:20
To: [EMAIL PROTECTED]
Cc: r-help@r-project.org
Subject: Re: [R] Cartesian Product Of Character Vectors

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-project.org
Subject: Re: [R] Cartesian Product Of Character Vectors

Does this satisfy?

levels(interaction(x,y))
[1] aaa.1 bbb.1 ccc.1 aaa.2 bbb.2 ccc.2 aaa.3 bbb.3
ccc.3

--
David Winsemius


On Dec 5, 2008, at 8:12 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 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 cant seem to
 get *apply to paste the column values together.

 Thanks
 Rory

 Rory Winston
 RBS Global Banking  Markets
 280 Bishopsgate, London, EC2M 4RB
 Office: +44 20 7085 4476



 **
 * The Royal Bank of Scotland plc. Registered in Scotland
 No 90312.
 Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
 Authorised and regulated by the Financial Services Authority

 This e-mail message is confidential and for use by the=2...{{dropped:
 25}}

 __
 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/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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
Office: +44 20 7085 4476

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daren Tan
Sent: 02 December 2008 09:37
To: [EMAIL PROTECTED]
Subject: [R] Can't load Rgraphviz on windows-based R


Hi,

I have problem loading Rgraphviz. Following the instructions specified by the 
README in Rgraphviz_1.20.3.tar.gz didn't help either.

o. set the following Windows environment variables accordingly
   (control panel - systems - Advanced - Environment Variables ):
   (a) create new user variables:
 GRAPHVIZ_INSTALL_DIR   (e.g., C:\Graphviz-2.21) 
-- I stated C:\Graphviz-2.21 (I also tried 
C:\/Graphviz-2.21)
 GRAPHVIZ_INSTALL_MAJOR (e.g., 2)
-- I stated 2
 GRAPHVIZ_INSTALL_MINOR (e.g., 20)   
-- I stated 21
 Notice the way \/ are used for the paths above.
   (b) add to user variable 'path': $GRAPHVIZ_INSTALL_DIR/bin
 e.g., C:\Graphviz-2.21\bin  
-- I stated C:\Graphviz-2.21\bin (I also tried 
C:\/Graphviz-2.21\/bin)


 library(Rgraphviz)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library 
'D:/PROGRA~1/R/R-28~1.0/library/Rgraphviz/libs/Rgraphviz.dll':
  LoadLibrary failure:  The specified module could not be found.

In addition: Warning messages:
1: closing unused connection 4 
(D:/PROGRA~1/R/R-28~1.0/library/Rgraphviz/libs/Rgraphviz.dll)
2: closing unused connection 3 
(D:/PROGRA~1/R/R-2.8.0/library/Rgraphviz/libs/Rgraphviz.dll)
Error : .onLoad failed in 'loadNamespace' for 'Rgraphviz'
Error: package/namespace load failed for 'Rgraphviz'

 file.exists(D:/PROGRA~1/R/R-28~1.0/library/Rgraphviz/libs/Rgraphviz.d
 ll)
[1] TRUE

 sessionInfo()
R version 2.8.0 (2008-10-20)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base 
packages:
[1] grid  stats graphics  grDevices utils datasets  methods   base
other attached packages:
[1] graph_1.20.0
loaded via a namespace (and not attached):
[1] cluster_1.11.11 tools_2.8.0

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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-defined range of colors 
based on the quartile of the data points?

Thanks
Rory

Rory Winston
RBS Global Banking  Markets
280 Bishopsgate, London, EC2M 4RB
Office: +44 20 7085 4476



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 not count repeated characters. I guess what I 
need is some kind of lookup table?

Cheers
Rory

Rory Winston
RBS Global Banking  Markets
280 Bishopsgate, London, EC2M 4RB
Office: +44 20 7085 4476



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 26

I have got it to work in a fairly non-elegant manner, using the following code:

sum ( unlist(lapply(strsplit(TESTING,), function(x) match(x,LETTERS) )) )

And over a list of names, this becomes:

lapply(namelist, function(Z) { sum ( unlist(lapply(strsplit(Z,), function(x) 
match(x,LETTERS) )) ) } )

But this is kind of ugly

Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: Marc Schwartz [mailto:[EMAIL PROTECTED]
Sent: 24 November 2008 15:09
To: WINSTON, Rory, GBM
Cc: r-help@r-project.org
Subject: Re: [R] Calculating sum of letter values

on 11/24/2008 08:57 AM [EMAIL PROTECTED] wrote:
 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 not count repeated characters. I guess what I need is 
 some kind of lookup table?

 Cheers
 Rory


 sum(as.numeric(factor(unlist(strsplit(ABCDA, )
[1] 11


Convert the letters to factors, after splitting the vector, which then enables 
the use of the underlying numeric codes:

 as.numeric(factor(unlist(strsplit(ABCDA, 
[1] 1 2 3 4 1

HTH,

Marc Schwartz

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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
Subject: Re: [R] Calculating sum of letter values

Yep, my error...it should be:

 as.numeric(factor(unlist(strsplit(ABCDA, )), levels = LETTERS))
[1] 1 2 3 4 1

 as.numeric(factor(unlist(strsplit(XYZ, )), levels = LETTERS))
[1] 24 25 26

The step that I missed was setting the factor levels to the full set of LETTERS.

HTH,

Marc

on 11/24/2008 09:14 AM [EMAIL PROTECTED] wrote:
 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 26

 I have got it to work in a fairly non-elegant manner, using the following 
 code:

 sum ( unlist(lapply(strsplit(TESTING,), function(x)
 match(x,LETTERS) )) )

 And over a list of names, this becomes:

 lapply(namelist, function(Z) { sum ( unlist(lapply(strsplit(Z,),
 function(x) match(x,LETTERS) )) ) } )

 But this is kind of ugly

 Rory Winston
 RBS Global Banking  Markets
 Office: +44 20 7085 4476

 -Original Message-
 From: Marc Schwartz [mailto:[EMAIL PROTECTED]
 Sent: 24 November 2008 15:09
 To: WINSTON, Rory, GBM
 Cc: r-help@r-project.org
 Subject: Re: [R] Calculating sum of letter values

 on 11/24/2008 08:57 AM [EMAIL PROTECTED] wrote:
 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 not count repeated characters. I guess what I need is 
 some kind of lookup table?

 Cheers
 Rory


 sum(as.numeric(factor(unlist(strsplit(ABCDA, )
 [1] 11


 Convert the letters to factors, after splitting the vector, which then 
 enables the use of the underlying numeric codes:

 as.numeric(factor(unlist(strsplit(ABCDA, 
 [1] 1 2 3 4 1

 HTH,

 Marc Schwartz


***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 correlation matrix of size 100 x 100 and would like to extract the 
diagonal matrix from it. I have used the for loop to store tha correlation 
values of the diagonal matrix. Is there a 'R way' of doing this?

Thanks in advance.

Kind regards,
Ezhil

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 prediction based on 
financial statements is based on much more fundamental techniques (e.g. a 
discounted cash flow analysis).

Rory


Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael
Sent: 22 October 2008 23:26
To: r-help; [EMAIL PROTECTED]
Subject: [R-SIG-Finance] forecasting earnings, sales and gross margin of a 
company...

Hi all,

I am playing with some companies' balance sheets and income statements and want 
to apply what I've just learned from Stats class to see if I can forecast the 
companies earnings, sales and gross margin in the short term (3rd and 4th 
Quarter), mid-term (2009) and long term (2011, etc. )

I pulled up some data from companies' financial statements over the past a few 
years. The companies are techs so don't have long history.
And given regime switching and big changes in the macro condition, I think long 
historical data have no use any way... so I have quarterly and annual data... 
and I probably need some other time series, for example the GDP, interest rate, 
consumer spending, etc.

How do I forecast the performance of the firms using R? I don't have much 
experience yet, for example, I probably have to de-trend the timeseries first, 
and then do some seasonality adjustment, etc. but I think it's very fun. Are 
there good hands-on tutorials about how to do these things in R, with realistic 
examples?

Thanks a lot!

___
[EMAIL PROTECTED] mailing list 
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tristan S B 
Fletcher
Sent: 25 September 2008 14:46
To: R-help@r-project.org
Subject: [R] nnet support

Hi

I have recently started using the nnet package but cannot find any 
documentation other than the one page titled 'nnet {nnet}' which is replicated 
several times over the internet and is found in the help file for this package.

I would like more information on how to use the package and have searched 
extensively over the internet but cannot find anything more. Do you know of any 
other sources of information on the package, perhaps a book that I should get 
hold of? Or has the package been replaced by another more recent one for which 
there is more support.

Any advice would be appreciated.

Thanks!

Tristan

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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.decisionstats.com
www.iwannacrib.com

On Tue, Sep 23, 2008 at 9:11 AM, Duncan Murdoch [EMAIL PROTECTED] wrote:
 Dave DeBarr wrote:

 I tried downloading R-2.7.2
 (http://cran.cnr.berkeley.edu/bin/windows/base/R-2.7.2-win32.exe,
 both from Berkeley and cran) and both times I got a warning from
 Computer Associates eTrust Antivirus (version 7.1.710) that the
 Win32/Adclicker.JO trojan was
 detected:
 The Win32/Adclicker.JO was detected in
 C:\USERS\USER\APPDATA\LOCAL\MICROSOFT\WINDOWS\TEMPORARY INTERNET
 FILES\LOW\CONTENT.IE5\61HAYRTG\R-2.7.2-WIN32[1].EXE.

 Has anyone else seen this?

 You're the first to report it, and 2.7.2 has been out for almost a
 month, so I think it's likely that the CRAN copy is uninfected.  Did
 you check the md5 checksum on it?  It matches on the original, so if
 it doesn't match at your end, you've got a bad download.

 If it matches and you still get the virus checker reporting, please
 let me know the details about that infection, and I'll try to do a
 manual inspection for it.

 Duncan Murdoch

 __
 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/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




--
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 2008 17:20
To: r-help@r-project.org
Subject: [R] Spectrum of a kernel

For purely educational purposes I would like to see the spectrum of a kernel. I 
tried:

spectrum(kernel(daniell, 100), taper=0, log=no)

but I get:

Error in complete.cases(object) : not all arguments have the same length

I can plot the kernel but that is only in the time-domain. I would like to see 
the spectrum of the kernel. Any ideas?

Kevin

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 way to extract all subsets of this frame by the Author 
column - i.e. that returns say a list of
data frames, each containing just the records for a specific value of Author?

Thanks
Rory

head(logs)

  Revision AuthorDate LinesChanged
16 user1  13/11/2007 15:41:53  488
2   11 user1 14/11/2007 09:04:433
3   12 user2 16/11/2007 12:26:04  522
4   13 user1 16/11/2007 12:27:55   90
5   14 user3 19/11/2007 09:32:54  159
6   15 user1 21/11/2007 13:38:41 1986



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:25}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 September 2008 14:48
To: r-help@r-project.org
Subject: [R] receiving Error: cannot allocate vector of size 1.5 Gb

Dear all,



In my attempt to run the below modelling command in R 2.7.0 under windows XP 
(4GB RAM with /3GB switch set) I receive the following error:

Error: cannot allocate vector of size 1.5 Gb



I have searched a bit and have tried adding: --max-mem-size=3071M  to the 
command line (when set to 3G I get the error that 3072M is too much)

I also run:

 memory.size()

[1] 11.26125

 memory.size(max=T)

[1] 13.4375



Modelling script:

model.females - quote(gamlss(WAZ11~cs(sqrtage,df=12)+country, 
sigma.formula=~cs(sqrtage,df=3)+country,

  nu.formula=~cs(sqrtage,df=1), tau.formula=~cs(sqrtage,df=1),

data=females, family=BCPE, control=con))

fit.females - eval(model.females)



the females  (1,654KB) that is being modelled by the GAMLSS package contains 
158,533 observations

I have further installed various memory optimization programs under XP but to 
no avail.

I believe that I perhaps need to set the Vcells and Ncells but am not sure 
which nor to what limits.

Any other help in maximizing my RAM usage in R would be great



I am quite a novice so please excuse any obvious mistakes or omissions.

Thank you in advance for your help



Dr. Daniel Hayes


[[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-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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), 500))
[1] 501

Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Glenn Lawyer
Sent: 27 August 2008 13:27
To: r-help@r-project.org
Subject: [R] Odd behavior in histogram breaks?

I am looking at histogram breaks, and notice something odd:
 foo - hist(runif(1),breaks=20)
 length(foo$breaks)
[1] 21
This makes sense to me.

 foo - hist(runif(1),breaks=200)
 length(foo$breaks)
[1] 201
This also makes sense.

BUT
 foo - hist(runif(1),breaks=250)
 length(foo$breaks)
[1] 201
 foo - hist(runif(10),breaks=250)
 length(foo$breaks)
[1] 201

Why only 201 breaks? Where did the other 50 go?

--

Here miracles become marvels, and
marvels recurring wonders.
-- William Beebe

Dr. Glenn Lawyer
+352 661 967 244
Instituttgruppe for psykiatri
Seksjon Vinderen
PB 85 Vinderen
0319 Oslo
http://folk.uio.no/davidgl

[[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-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Rau
Sent: 21 August 2008 20:04
To: Avram Aelony
Cc: r-help@r-project.org
Subject: Re: [R] Large data sets with R (binding to hadoop available?)

Hi

Avram Aelony wrote:

 Dear R community,

 I find R fantastic and use R whenever I can for my data analytic needs.
 Certain data sets, however, are so large that other tools seem to be
 needed to pre-process data such that it can be brought into R for
 further analysis.

 Questions I have for the many expert contributors on this list are:

 1. How do others handle situations of large data sets (gigabytes,
 terabytes) for analysis in R ?

I usually try to store the data in an SQLite database and interface via 
functions from the packages RSQLite (and DBI).

No idea about Question No. 2, though.

Hope this helps,
Roland


P.S. When I am sure that I only need a certain subset of large data sets, I 
still prefer to do some pre-processing in awk (gawk).
2.P.S. The size of my data sets are in the gigabyte range (not terabyte range). 
This might be important if your data sets are *really large* and you want to 
use sqlite: http://www.sqlite.org/whentouse.html

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 R?
thanks

Y.





[[alternative HTML version deleted]]


***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 performance difference 
(especially for integer vectors):

 x - trunc(runif(1E6, 1, 100))
 system.time(y - x[order(x)])
   user  system elapsed
   1.190.011.21
 system.time(y - sort(x))
   user  system elapsed
   0.220.000.22

I suspect that the propensity for the order/reindex idiom may be related to 
memory or space performance then, rather than time? Can anyone confirm if this 
is the case?

Cheers
Rory



***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.