Displaying 4 results from an estimated 4 matches for "dailypl".
2010 Jun 02
8
bind select data frames
Dear group,
Here is my environment:
> ls()
[1] "DailyPL100419" "DailyPL100420" "DailyPL100421" "dd" "i"
"l" "PLglobal" "Pos100416" "Pos100419" "Pos100420"
"Pos100421" "position"
[13] "result...
2010 May 24
1
writing function:loop and rbind
Dear group,
I have a function, let's call it myfun, wich give me a list of result:
R1,R2,R3...
There is a loop in this function to get my results. Here is the structure of
my function:
Myfun<-function()
{
For (i in X ){
-----------instructions---------
Ri
{
{
All Results (R1,R2...) are Data.frame. As a final result (call it "Final"),
I need to rbind all these dataframe. One
2010 May 26
2
writing function : can't find an object
...olumns, then merge with PosB,
replace NA by zero and assign the final result to element PL
zz<-merge(transform(merge(value,allcon,all.y=T),SHORTDESCRIPTION=NULL,
VALUE=NULL,PL=-VALUE*pl,quantity=NULL),PosB,all.x=T,sort=F)
zz[is.na(zz)]<-0
#PL<-zz[c(1,3,4)]
assign(paste("DailyPL",y,sep=""),zz[,c(1,3,4)],envir=.GlobalEnv)
}
Here is what I get :
> PLDaily(100524,100525)
Error in as.data.frame(y) : object 'PosB' not found
> ls()
[1] "PLDaily" "Pos100524" "Pos100525" "position" "sel"...
2010 May 20
6
writing function
Dear group,
I am trying to write functions, but as a beginner, everything is not so
obvious.
Let's say I want the results in a list of elemts like this :
tot1, tot2, etc
Here is a function:
toto <-
function(x,y)
{
for(i in x:y){
paste(c("tot",i),collapse="")<-(i*2)
}
}
If I type this :
>toto(1,5)
I get this message error:
Error in paste(c("tot",