Re: [R] writing function : can't find an object

2010-05-26 Thread Ivan Calandra
Hi, The first problem (I think) is your for loop: for (i in sel), what is "sel"?! Then you might want to write "position[i]" and "trade[i]" (I don't think that position and trade are functions, or they are in a package you don't specify). Depending on the class of position and trade, you might

Re: [R] writing function : can't find an object

2010-05-26 Thread Peter Ehlers
On 2010-05-26 1:17, arnaud Gaboury wrote: Dear group, Here is my function: #return the daily PL for day y PLDaily<-function(x,y) { #find elements in my directory with "LSCPos" in the name, keep the numeric part in the name and #create a list l<-gsub("\\D","",dir()[grep("LSCPos",dir())])

[R] writing function : can't find an object

2010-05-26 Thread arnaud Gaboury
Dear group, Here is my function: #return the daily PL for day y PLDaily<-function(x,y) { #find elements in my directory with "LSCPos" in the name, keep the numeric part in the name and #create a list l<-gsub("\\D","",dir()[grep("LSCPos",dir())]) #select in the list the desired elements