Displaying 1 result from an estimated 1 matches for "entity_returns".
2012 Jan 11
1
Constructing a data.frame from csv files
....3,48.7,46.2,44.2,42.2,40.8))
attach(mydata)
opt_return_volatilty = function(price, instru_name)
{
price_returns = matrix(data = NA, nrow = (length(price)-1), ncol = 1)
for (i in(1:(length(price)-1)))
{
price_returns[i] = log(price[i]/price[i+1])
}
volatility = sd(price_returns)
entity_returns = unique(instru_name)
colnames(price_returns) = entity_returns
write.csv(price_returns, file = paste(entity_returns, ".csv", sep = ""), row.names = FALSE)
return(data.frame(list(volatility = volatility)))
}
entity_volatility <- ddply(.data=mydata, .variables = "instr...