|
发表于 2015-6-18 14:08:19
|
显示全部楼层
- growplot<-function(x,n){
- y=matrix(data=NA,nrow=(nrow(x)-1),ncol=n)
- for(t in 1:nrow(y)){
- for(j in 1:n){
- y[t,j]=(x[t+1,j]-x[t,j])/x[t,j]
- }
- }
- matplot(1:nrow(y),y[,1:ncol(y)],type="l")
- return(y)
- }
- x<-matrix(1:30,nrow=5,ncol=6)
- growplot(x,ncol(x))
复制代码
|
|