[R] R compilation

2009-01-28 Thread Attiglah, Mama
Hi Mates, I have a very long R code that needs to go to production but my portfolio managers do not use R language and the software is not supported by my bank. Is there any way I can compile the code to an executable file and make it usable to my portfolio managers who have no knowledge at al

Re: [R] pivot table in R

2008-01-29 Thread Attiglah, Mama
A = read.table("clipboard", header=TRUE) > A sex age region no_of_accidents 1 F young north 10 2 F young south 12 3 F old north 5 4 F old south 7 5 M young north 24 6 M young south 30 7 M o

Re: [R] how to generate sequence "a" - "z"

2008-01-29 Thread Attiglah, Mama
> letters [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" > LETTERS [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" > Hope that will help. Mama - Mama Attiglah, PhD Adva

[R] Compiling R code

2008-01-29 Thread Attiglah, Mama
Hi all, I am struggling to compile a massive R code that I have written through some years, aiming to provide automated investment strategies to my Portfolio Managers. You may ask me why do I not rewrite the code in C or C++; the answer is it is really massive and that will take me lots of time.

Re: [R] How to get two y-axises in a bar plot?

2008-01-29 Thread Attiglah, Mama
Try this X = rbind(y1, y2) colnames(X) = as.character(x) barplot( X, density=c(35,40), col=c("red","blue"), beside=FALSE) barplot( X, density=c(35,40), col=c("red","blue"), beside=TRUE) Alternatively, barplot( y1, ylim = c(0, max(y1,y2)), col="blue", beside=FALSE) par(new=TRUE) barplot( y2

Re: [R] Multiplying each row of a big matrix with a vector

2008-01-30 Thread Attiglah, Mama
Ret= matrix(sample( 1:1000, 500*9), nrow=500, ncol=9) Pos= c( 2593419 ,2130220, 6198197, 1673888, 198 , 1784732 , 2052120 ,-7490228 ,-5275000) Solution = Ret * matrix( rep(Pos, 500), nrow=500, byrow=TRUE) Use the element-wise multiplication rather than a matrix multiplication. Hope th

Re: [R] Multiplying each row of a big matrix with a vector

2008-01-30 Thread Attiglah, Mama
Attiglah, Mama Sent: 30 January 2008 11:32 To: Megh Dal; [EMAIL PROTECTED] Subject: Re: [R] Multiplying each row of a big matrix with a vector Ret= matrix(sample( 1:1000, 500*9), nrow=500, ncol=9) Pos= c( 2593419 ,2130220, 6198197, 1673888, 198 , 1784732 , 2052120 ,-7490228 ,-5275000

Re: [R] Concatenate xyplots

2008-01-30 Thread Attiglah, Mama
Hi room, Is there any R package that solves a non linear objective pb, with linear equality constraint? A simple example a =c (2, 5, 6, 7, 2) b = c (7, 1, 4, 5, 6) a and b are vectors of length 5 minimise f(x, a) = sum( (x-a)^2) such that sum( x*b) = 50. where x is the control varia

[R] Non linear optimising with a linear equality constraints

2008-01-30 Thread Attiglah, Mama
Hi room, Is there any R package that solves a non linear objective pb, with linear equality constraint? A simple example a =c (2, 5, 6, 7, 2) b = c (7, 1, 4, 5, 6) a and b are vectors of length 5 minimise f(x, a) = sum( (x-a)^2) such that sum( x*b) = 50. where x is the control var

Re: [R] re stricting points in a data frame

2008-01-30 Thread Attiglah, Mama
Let's A = expand.grid(xk1=xk1,xk2=xk2) B = A[A[,1] %in% x1 & A[,2] %in% x2, ] Should in principle produce the desired result. Mama - Mama Attiglah, PhD Advanced Research Center Quantitative Research Analyst State Street Bank +44(0)20 7698 6290 (Direct Line) +44 (0)207 004 2968 (Direct Fax