Displaying 5 results from an estimated 5 matches similar to: "writing function:loop and rbind"
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" "sel"
2010 May 21
4
indexing problem
Dear group,
Here is my environment :
> ls()
[1] "l" "PLglobal" "Pos100415" "Pos100416" "Pos100419"
"Pos100420" "position" "select" "Trad100415" "Trad100416"
"Trad100419" "Trad100420" "trade" "y"
With objects :
> l
[1]
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",
2010 May 26
2
writing function : can't find an object
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
2010 May 13
1
access objects in my environment
Dear group,
Here are my objects in my environment:
> ls()
[1] "Pos100415" "Pos100416" "posA" "pose15" "pose16" "pose16t"
"position" "trade" "x"
I need to pass the object "Pos100415" to a function. This element is a
data.frame, obtained through a function: Pos(x)<-myfun(x)