Displaying 1 result from an estimated 1 matches for "matrix_ret".
2008 Oct 07
1
FW: Reading Data
...}
for(j in 2:length(date))
{
if(date[j]==ED)
p[2]=data[i,j]
}
}
returns=(p[2]/p[1])-1
}
#print(p)
#print(I)
return(returns)
}
##The original Funda##
matrix_ret=matrix(0,length(q_ins),length(q_sd))
for(i in 1:length(q_sd))
{
for(j in 1:length(q_ins))
{
matrix_ret[j,i]=returns(q_ins[j],q_sd[i],q_ed[i])
}
}
#Removing NA from the matrix
matrix_ret1=sapply(X=matrix_ret, FUN=function(x)
ifelse(is.na(x),0.00,x))
matrix_ret=matrix(matrix_ret1,length(q_...